Webhook Port using a reverse proxy


Is it somehow possible to use a different port for the webhooks than for the admin interface?
I am running N8N on Linux via pm2 and it is behind a nginx reverse proxy. The admin interface is secured via basic auth, but I would still rather not have it open to the public.

Hi @Felix,

I think this is possible but it’s not something that could be configured in n8n directly in this scenario.

Seeing you have your reverse proxy configured in nginx, you could try adding a second server block with a different listen directive specifying the port (and also set location/rewrite/proxy_pass as required to make sure the second server block only forwards to /webhook-test, /webhook, and /webhook-waiting).

You should then be able to configure both blocks independently from each other. It’s been a while since I’ve done something like this, so don’t have an example ready. But there should be plenty of nginx-specific resources out there. If you run into any trouble, let me know and I’ll see if I can refresh my memory on nginx :slight_smile:

1 Like

Hey @Felix,

Have you tried setting the N8N_PORT env variable in your PM2 config?