When a Dedicated Cloud Gateway proxies traffic to upstream services over the public internet, you need security controls across the full request path.
These validate who can call your APIs, and ensure your upstream services can trust that requests genuinely originate from Kong.
There are multiple security controls you can use to protect public Dedicated Cloud Gateways:
- Allow Kong proxy traffic by allowlisting egress IPs.
- Validate inbound API consumers before requests reach your upstream (mTLS Auth, OIDC).
- Authenticate Kong to your upstream service (upstream mTLS, shared secrets).
- Secure the inbound entry point itself (CDN/WAF).
These security controls protect against the following:
|
Layer
|
Control
|
Protects against
|
|
Network
|
Egress IP allowlisting
|
Unauthorized source IPs
|
|
Transport
|
Upstream mTLS
|
Impersonation, man-in-the-middle (MITM)
|
|
Application
|
Shared secret header
|
Bypassed IP rules
|
|
Application
|
OIDC/JWT validation
|
Unauthorized callers
|
Public Dedicated Cloud Gateway security controls are complementary.
A robust public internet configuration typically combines multiple layers:
- A minimal production configuration for sensitive services: Egress IP
allowlisting with upstream mTLS
- A configuration for services that cannot do mTLS: Egress IP allowlisting with
shared secret and OIDC
Note: We strongly recommend combining IP allowlisting with additional security controls in production.
For workloads with stricter isolation requirements, consider
private upstream connectivity
instead.
Public Dedicated Cloud Gateways are subjected to scanners when they are created, like any other publicly-exposed network.
We recommend creating and securing your public Dedicated Cloud Gateway in the following order:
-
Before creating Gateway Services and Routes, create the Dedicated Cloud Gateway network and control plane in Konnect.
The network will be scanned, but since there aren’t any Routes, scanners get 404s or connection resets.
- Configure your CDN/WAF in front of the Dedicated Cloud Gateway data plane before you configure any Routes or Services.
- Allowlist the Dedicated Cloud Gateway network egress IPs.
- Configure the IP Restriction plugin globally (allowlisting your CDN’s egress IPs) so that even if someone hits the Dedicated Cloud Gateway data plane directly, they get rejected before any Route matching happens.
- Configure your Routes and Services pointing to real upstreams.
You can use a Web Application Firewall (WAF) in front of your Dedicated Cloud Gateway as a first-line defense that filters and blocks malicious traffic before it reaches Kong Gateway.
A WAF provides Layer 7 protection for HTTP(S) traffic and helps protect APIs against:
- OWASP Top 10 vulnerabilities
- Malicious bot traffic
- IP reputation threats
- Rate-based abuse
- Geo-based access restrictions
Kong strongly recommends configuring a WAF for public Dedicated Cloud Gateways.
WAF configuration differs for public deployments.
A public Fully Qualified Domain Name (FQDN) exposes the Public Dedicated Cloud Gateways.
WAF inspection requires HTTP visibility, which means the WAF must sit at an HTTP-aware layer, like:
- A CDN distribution
- An Application Load Balancer
- A cloud edge service
Because the Kong-managed Dedicated Cloud Gateway data plane exposes a DNS hostname instead of an IP address, you can’t chain another public load balancer in front of it (most load balancers’ target groups don’t support DNS-based targets).
Instead, you must use a CDN because it natively supports DNS-based origins and can attach WAF policies at the distribution level.
Examples of CDN or edge services that support this pattern:
- Amazon CloudFront with AWS WAF
- Azure Front Door with Azure WAF
- Cloudflare (WAF built in)
- Fastly with Next-Gen WAF
The following diagram shows how traffic flows through a public Dedicated Cloud Gateway with an AWS WAF:
sequenceDiagram
Client->>+CloudFront/WAF: Sends request, TLS terminated
CloudFront/WAF->>CloudFront/WAF: WAF evaluates
alt WAF blocks request
CloudFront/WAF-->>Client: 403 Forbidden
else WAF passes request
CloudFront/WAF->>CloudFront/WAF: CloudFront injects origin header
CloudFront/WAF->>Kong DP: Forwards request
Kong DP->>Kong DP: Validates header
alt Header missing or invalid
Kong DP-->>Client: 403 Forbidden
else Header valid
Kong DP->>Kong DP: Matches route
Kong DP->>Your upstream in AWS: Applies plugins, proxies request
Your upstream in AWS-->>Kong DP: Response
Kong DP-->>CloudFront/WAF: Response
CloudFront/WAF-->>Client: Response
end
end
In this model:
- CloudFront acts as the public edge entry point.
- AWS WAF is attached to the CloudFront distribution.
- The CloudFront origin is the Dedicated Cloud Gateway public DNS edge (public FQDN).
- The Dedicated Cloud Gateway data plane receives traffic from CloudFront and forwards it to the gateway data planes.
The sections in this guide describe how to configure a WAF in AWS, but they can be adapted for Azure and GCP.
For more information about all Kong Gateway WAF configurations and plugins, see Kong Gateway WAF capabilities.
When a Dedicated Cloud Gateway is deployed in public mode, it exposes a public FQDN.
Without additional controls, clients could attempt to access this public endpoint directly and bypass CloudFront and AWS WAF protections.
To ensure all traffic passes through CloudFront, configure origin validation between CloudFront and Kong:
- Configure CloudFront to inject a custom origin header. For example:
X-Origin-Verify: <shared-secret-value>.
- Configure your Dedicated Cloud Gateway to require the header. You can do this in two different ways:
- Reject requests that don’t include the expected header value.
- Store the shared header value securely, like in a Vault, and rotate the shared secret periodically.
- If your CDN publishes static egress IP ranges, configure the IP Restriction plugin globally (allowlisting your CDN’s egress IPs).
Requests arriving from IPs outside the CDN’s published ranges are rejected at the Kong layer before any route matching occurs.
Some CDNs that publish static egress IP ranges include CloudFront, Cloudflare, Azure Front Door, and Fastly.
- Combine origin validation with AWS WAF managed rules and rate limiting for layered protection.
Konnect exposes the static egress IP addresses for your Dedicated Cloud Gateway network in the Konnect UI.
You must configure your upstream firewall, security group, or load balancer to accept inbound connections from these IPs only.
This ensures that even if a Service is publicly accessible, only your Kong data
planes can call it.
Egress IPs are scoped per Dedicated Cloud Gateway network and per region.
If you use multiple Dedicated Cloud Gateway networks, allowlist the egress IPs from each relevant network.
To allowlist the egress IPs, do the following:
- In the Konnect sidebar, click API Gateway.
- Click your Dedicated Cloud Gateway.
- Click Connect.
- Copy and save the IPs listed in Public Egress IPs.
- In your cloud provider console, add inbound rules to your upstream service’s
security group or firewall to allow traffic from those IP ranges on the
relevant port (typically 443 or 80).
- Restrict inbound traffic on that port to the allowlisted IPs, in addition
to any other legitimately permitted sources.
Mutual TLS authenticates both the Kong data plane and your upstream service cryptographically.
The upstream rejects any connection that doesn’t present a valid certificate, regardless of source IP.
This provides a strong identity guarantee even if an IP allowlist is bypassed or shared with another system.
Kong supports two mTLS modes for upstream connections: upstream mTLS and inbound mTLS.
Kong presents a client certificate to your upstream service when establishing
the connection.
Configure this on the Kong Service object by referencing a
certificate stored in Konnect via the client_certificate field.
The following is an example Service configuration using decK:
_format_version: "3.0"
services:
- name: my-service
url: https://api.internal.example.com
client_certificate:
id: "$CERT_ID"
tls_verify: true
ca_certificates:
- "$CA_CERT_ID"
In this example, your upstream verifies Kong’s client certificate against a known CA before accepting the connection.
The mTLS Auth plugin validates client certificates presented to Kong from downstream API consumers.
Use this when your consumers must also authenticate with certificates, creating end-to-end mutual authentication.
For Services handling sensitive data, combine upstream mTLS with egress IP allowlisting for in-depth defense.
Example plugin configuration:
echo '
_format_version: "3.0"
plugins:
- name: mtls-auth
service: my-service
config:
ca_certificates:
- "$CA_CERT_ID"
' | deck gateway apply -
If your upstream service cannot terminate mTLS but you need a lightweight way
to verify that requests originate from Kong, inject a shared secret header
using the Request Transformer plugin.
Example plugin configuration:
echo '
_format_version: "3.0"
plugins:
- name: request-transformer
config:
add:
headers:
- x-kong-origin-verify:{vault://env/KONG_SHARED_SECRET}
' | deck gateway apply -
Replace env/KONG_SHARED_SECRET with the path matching your configured
vault backend (hcv, aws, gcp, or env). See the
Secrets management documentation
for vault configuration options.
Your upstream service validates the presence and value of this header before
processing the request. If the header is absent or incorrect, the upstream
rejects the request.
Keep the following in mind:
- Store the secret as a Konnect Vault reference, not as a plaintext value
- Rotate the secret on a regular schedule
- Combine with egress IP allowlisting so the header alone isn’t the only control
For APIs where caller identity matters beyond network origin, use the
OpenID Connect plugin
to validate JWTs or opaque tokens before forwarding requests upstream.
Kong does the following:
- Validates the token at the Gateway.
- Forwards claims to your upstream as headers.
Your backend receives a verified identity without needing to perform its own token validation.
This is particularly useful when:
- Upstream services are shared across multiple calling systems
- You want Kong to act as the centralized token validation and enforcement point
- You need fine-grained authorization based on token claims (scopes, roles, tenant ID)
For an example plugin configuration, see JWT access token authentication