Reason will be(most probably), there will be mismatch b/w your code and your config, available on AEM. And since there will not be any mode set for the path in filter.xml so after every deployment your code will be overwriting the policy config in AEM and that is why your policy get removed( ideally...