I have deployed n8n on Kubernetes. The n8n UI and webhook are exposed through a private NGINX Ingress controller. I would like to proxy the n8n webhook through AWS API Gateway in order to:
API Gateway custom domain: n8n-webhook-public.mydomain.com
API Gateway integration: via VPC link
API Gateway integration proxy n8n-webhook-private.mydomain.comto n8n-webhook-public.mydomain.com
Issue:
When I access n8n-webhook-public.mydomain.com, the site is redirected to n8n-webhook-private.mydomain.com. This is incorrect — it doesn’t work publicly and eventually times out.
I tried setting the webhook.url in the Helm chart like this:
@n8nn19x The problem is that n8n is redirecting to its internal URL because it doesn’t know it’s being proxied. To fix this, you need to configure n8n to recognize the public URL.
Set environment variables like N8N_HOST, N8N_PORT, N8N_PROTOCOL, and N8N_WEBHOOK_URL to point to your public URL.
Pass the original host header and set X-Forwarded-Host and X-Forwarded-Proto headers.
Create a ConfigMap to set the webhook URL.
The architecture looks like this:
Public Client → API Gateway → AWS WAF → VPC Link → NGINX Ingress → n8n Pod
To verify the setup, you can use curl to test the webhook URL with the correct headers.
If you still face issues, check the n8n logs, API Gateway logs, and VPC Link connectivity.
Finally, add some security enhancements by setting headers like Strict-Transport-Security, X-Content-Type-Options, and X-Frame-Options in API Gateway.
Does this make sense or do you want me to walk you through each step?