N8n selfhosted docker behind traefik

I try to run n8n on a vps in a docker, behind traefik and cloud flare. the problem is, that the webhook links have the port number inside. test url I get to work, but production still have the port inside the link

if I try to set n8n_port to 443 I get bad gateway or 502 from cloud flare

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    env_file:
      - .env
    environment:
      - N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE}
      - N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER}
      - N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD}
      - N8N_PROTOCOL=https
      - N8N_HOST=n8n.wesa-dress.de
      - WEBHOOK_URL=https://n8n.wesa-dress.de
      - N8N_EDITOR_BASE_URL=https://n8n.wesa-dress.de
      # Du lässt N8N_PORT entweder weg oder setzt ihn auf den internen Wert (5678)
    volumes:
      - /home/ubuntu/docker/n8n/data:/home/node/.n8n
    networks:
      - proxy
    # Hinweis: Entferne hier jegliche "ports:"-Angabe, damit n8n nicht direkt vom Host erreichbar ist.

Information on your n8n setup

  • n8n version: the latest
  • default: SQLite**
  • n8n EXECUTIONS_PROCESS setting default
  • Running n8n via docker
  • Operating system: linux

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system: