Skip to main content
A self-hosted AI Gateway blocks outbound requests to private IP ranges and internal hostnames by default, to prevent SSRF attacks. To reach services on your own network, add them to the TRUSTED_CUSTOM_HOSTS allowlist on the gateway. You need this when the gateway calls any of these on a private address:
TRUSTED_CUSTOM_HOSTS is available only on hybrid and air-gapped deployments. On AI Gateway SaaS, upstream URLs must be publicly reachable.

Recognize the error

When the gateway blocks a request, the log entry in Strata Cloud ManagerAI SecurityAI GatewayObservabilityLogs looks like this:
MCP clients often don’t see this message. An MCP initialize call may just return a generic error such as Failed to restore session. Please reinitialize.. If an internal MCP server fails to connect, check the Observability logs for the SSRF message first.

Allowlist the hostname, not the IP

The allowlist is checked against the hostname in the upstream URL. When the hostname is trusted, the gateway also accepts whatever private IPs it resolves to. Adding only the resolved IP doesn’t help if the URL uses a hostname.
The error message names the resolved IP (resolves to 10.110.2.26, which is blocked), but the fix is to trust the hostname shown before it. Copy the hostname straight from the error or the MCP Registry URL. A single-character typo leaves the host blocked.
Other rules to keep in mind:
  • Setting the variable replaces the defaults. When NODE_ENV is production, the allowlist is empty until you set it. If you still need localhost, 127.0.0.1, ::1, or host.docker.internal, include them in your list.
  • A bare domain doesn’t cover its subdomains. example.net doesn’t trust mcp.example.net. Use *.example.net to trust the domain and all of its subdomains.
  • Some destinations can never be trusted. Cloud metadata endpoints, metadata hostname suffixes such as cluster.local, and non-HTTP ports such as 5432 stay blocked even when listed. See Custom hosts for the full list.

Set TRUSTED_CUSTOM_HOSTS

Set the variable on the gateway service, which also serves the MCP Gateway when SERVER_MODE / server_mode is mcp or all. The value is a comma-separated list with no spaces. The variable is read at startup, so running containers must be restarted to pick up a change.
Add the variable under environment.data in values.yaml:
Apply the change and restart the gateway pods:

Verify the allowlist

Startup logs don’t print the allowlist, so check the environment inside the running gateway container:
Compare the output character by character against the hostname in the SSRF error. Then send the request again, for example an MCP initialize call:
A successful response returns the server’s capabilities, and the Observability log shows no SSRF error.

Troubleshooting

Custom hosts

The full SSRF rule set and allowlist entry format.

Internal MCP servers

Register a private MCP server in the MCP Registry.
Last modified on September 23, 2026