Stop Policy execution

i need to control executing a policy or not depending on the running env

For example i need to execute CORS policy only on dev and test but not on production

I don’t want to set a config with the env name ? any other solutions

Hello,

At what level does this CORS policy need to be applied, is it the environment level (ie: for all proxies within the environment) or is it on a per proxy basis?

If this policy is scoped to the environment level, you could use a flow hook (see more here: https://cloud.google.com/apigee/docs/api-platform/fundamentals/flow-hooks) to ensure a set of policies (CORS, etc) are applied for all traffic within the dev/test environment construct.

If this is specific to a proxy within your environment, are there any other pertinent client details (ie: client IP addresses/client identifiers/etc) that could help with this conditional expression? If yes, you could in theory extract that information from the request context, and validate based on a property set/KVM that can be dynamically updated as needed.

Hope this helps!