edge-cors-policy is a Kong plugin that enforces CORS decisions at the gateway boundary instead of delegating them to upstream applications.
It validates the incoming Origin, evaluates preflight method and header requests, short-circuits preflight traffic, and emits deterministic CORS response headers.
cd edge-cors-policy
luarocks makeOr install a built rock:
luarocks install kong-plugin-edge-cors-policy-1.0.0-1.all.rockEnable it in Kong:
export KONG_PLUGINS=bundled,edge-cors-policyFrom the external_plugins directory:
luarocks make kong-plugins-bundle-1.0.0-1.rockspecThen enable the plugin by name:
export KONG_PLUGINS=bundled,edge-cors-policy- Parses and validates the
Originheader. - Allows exact origins or host suffixes.
- Handles preflight requests in the plugin without proxying upstream.
- Rejects or silently denies disallowed origins depending on config.
- Extends
Varycorrectly for cache safety.
allow_all_originsallowed_originsallowed_host_suffixesallow_methodsallow_headersexpose_headersallow_credentialsmax_agereject_disallowed_originsreject_status_codeallow_private_network
See schema.lua for the exact schema and defaults.