Webhook URL Shows localhost Instead of VPS IP or FQDN

Hi community,

I’m running n8n on a hosted VPS, and overall things are working great. However, I’m facing an issue specifically with incoming webhooks.

The webhook URLs generated by n8n are showing up like this:

http://localhost:5678/webhook-test/xxxxxxxxxxxx

But I want them to use my VPS public IP or Fully Qualified Domain Name (FQDN), like:

http://mydomain.com:5678/webhook-test/xxxxxxxxxxxx

or

http://xx.xx.xx.xx:5678/webhook-test/xxxxxxxxxxxx

Everything else seems to be working fine. I would really appreciate help on how to configure this properly so that webhook URLs are generated using my public address instead of localhost.

Thanks in advance!

The environment variableWEBHOOK_URL does the trick.

Depending on how you start n8n:

  • Cli: WEBHOOK_URL=https://example.com n8n start
  • Docker: docker run -e WEBHOOK_URL=https://example.com n8nio/n8n
  • Docker compose:
version: '3'

services:
  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "5678:5678"
    environment:
      - WEBHOOK_URL=https://example.com
    volumes:
      - ~/.n8n:/home/node/.n8n

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.