Reverse proxy and custom webhook domain (Without port)

Hello! I want to use 2 domains for n8n.
1 - to access the web panel: n8n.exaple.com on port 443
2 - for webhooks wh.exaple.com on port 443
n8n works in the Docker. All requests are proxied by Nginx Proxy Manager and ACL is configured on n8n.exaple.com, when I try to go to this address, asked for a password. That’s why I can’t use webhook on this domain name.

Problem: I can’t set up 2 domains on port 443.

The problem starts when I try to set up n8n for different domain names. If I use n8n.exaple.com to port 443, then it will already be taken, and I cannot use another wh.exaple.com domain on port 443. If I set it to a different address, for example wh.exaple.com:4443 and set up a reverse proxy, then everything works fine, but in the n8n web interface, access to the webhook is displayed as wh.exaple.com:4443, although in fact it is wh.exaple.com:443(https://wh.exaple.com) because of the reverse proxy and I have to change the address myself every time I type it into the browser.

NOW:

NEED:

Port settings and everoment:

    environment:
      - GENERIC_TIMEZONE=Europe/Berlin
      - TZ=Europe/Berlin
      - N8N_HOST=n8n.exaple.com
      - N8N_PROTOCOL=https
      - N8N_PORT=443
      - WEBHOOK_URL=https://wh.exaple.com:4443/
      - WEBHOOK_TUNNEL_URL=https://wh.exaple.com:4443/
      - VUE_APP_URL_BASE_API=https://wh.exaple.com:4443/
      - N8N_EDITOR_BASE_URL=http://n8n.exaple.com/
      - DB_TYPE=mariadb
      - DB_MYSQLDB_HOST=mariadb
      - DB_MYSQLDB_PORT=3306
      - DB_MYSQLDB_DATABASE=n8n
      - DB_MYSQLDB_USER=n8n
      - DB_MYSQLDB_PASSWORD=[HIDE PASSWORD]
      - NODE_ENV=production
    ports:
      - "127.0.0.1:5678:443"
      - "127.0.0.1:4443:4443"

Hey @wedlex,

That looks overly complicated, So the first thing I would do is change n8n to go back to using port 5678 and set your container to listen on the host to 5678 as well if you want that part doesn’t really matter for what you are doing.

Next up set the URLs to not have the ports at all as they won’t be needed, The good thing with nginx and any other reverse proxy is you can have multiple sites on the same port I do this with the services I run so your proxy will listen on 443 for the connections then route the traffic based on the server name.

So in your proxy you would set up 2 entries…

wh.exaple.com which has an ACL / custom location set so only /webhook and /webhook-test can be used then you would make sure your n8n.exaple.com has your current ACL on it and redirects to the same host and port.

So with this setup you should have…

Nginx Proxy Manager listening on port 443 and directing traffic back to 5678
n8n listening on 5678 internally and in the container

This should solve your problem, The only bit I am not sure about is how you would set up the custom locations to work but I might look into that in more detail one evening as I currently use nginx proxy manager for my own setup at the moment with over 20 services all listening on 443 for connections.

When remove the ports which domain do I need to specify in which environment variables? Where is http://n8n.expamle.com and where is wh.example.com?

  - WEBHOOK_URL=https://n8n.expamle.com/
  - WEBHOOK_TUNNEL_URL=https://n8n.expamle.com/
  - VUE_APP_URL_BASE_API=https://n8n.expamle.com/
  - N8N_EDITOR_BASE_URL=http://n8n.expamle.com/

editor base and vue_app are n8n.xxx and the other 2 are wh.xxx

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