Port Included in Email Notifications?

Hey all!

I’m self-hotsing n8n on a Linode compute instance using docker-compose (see below for my docker-compose file). When I spin up the containers, everything works swimmingly, and my editor is accessible at the URL I expect it to be (no port, I’m using a subdomain). However, when I invite a user to join my n8n environment, the “claim your invite” link contains the n8n port at the end:

https://subdomain.mydomain.com:5678/signup....

When a user clicks the link, it doesn’t take them to the signup page. However, manually removing the port works fine!

Is there a way to tell the n8n container to run on a specific port, but to not include that port in any public-facing copy that goes out to users?

docker-compose.yaml file below:

version: "3"

services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
      - traefik.http.routers.n8n.middlewares=n8n@docker
    environment:
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
    env_file:
      - .env
    volumes:
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
      - /home/alphaomega/n8n-local-files:/files

Welcome to the community @AndrewMitchell !

It looks like you followed our Server Setup guide here but then deleted parts of it. One of the things you deleted was the variable WEBHOOK_URL. Please set it again, it should then work as expected.

1 Like

Thanks a TON! I knew I was missing something.

1 Like

Glad that it helped.

Have fun!

Btw. also looks like you removed GENERIC_TIMEZONE which is very important to set if you rely on Cron/Schedule nodes. If you do not set the variable they will either all trigger at the wrong time or you will have to set the time zone manually for each workflow one by one (which is neither fun and also easy to forget).

Thanks! I have GENERIC_TIMEZONE defined in my .env file and it looks like it’s pulling in properly. I deleted most of the env variables from docker-compose.yml because I moved them into the .env and just figured I’d reference the .env file rather than having to update both an .env and the corresponding docker-compose line… Just lost track of the WEBHOOK_URL variable in the transition!

1 Like

Ah OK, that is good!

2 Likes

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