Traefik and N8N = wss://sub.domain.com/rest/push?pushRef=7hhhghsg

Describe the problem/error/question

Websocket does not work.

n8n yaml:

networks:
      - proxy
    ports:
      - 5678:5678
    
    labels:
     
      - "traefik.enable=true"
      - "traefik.docker.network=proxy" 
     
      - "traefik.http.routers.n8n_app.rule=Host(`sub.domain.com`)"
      - "traefik.http.routers.n8n_app.entrypoints=websecure"
      - "traefik.http.routers.n8n_app.tls=true"
      - "traefik.http.routers.n8n_app.tls.certresolver=myresolver"
      - "traefik.http.services.n8n_app.loadbalancer.server.port=5678"


    environment:
      - N8N_HOST=sub.domain.com
      - N8N_BASIC_AUTH_ACTIVE=false
      # - N8N_PORT=443
      - N8N_PROTOCOL=https
      - N8N_EDITOR_BASE_URL=https://sub.domain.com/
      # - N8N_PUSH_BACKEND=sse
      - N8N_SECURE_COOKIE=true
      - N8N_TRUST_PROXY=true
      - N8N_PUSH_BACKEND=websocket
      - N8N_ALLOW_CONNECTIONS_FROM=https://sub.domain.com
      - NODE_ENV=production
      - N8N_PROXY_HOPS=1
      - N8N_LOG_LEVEL=debug
      - WEBHOOK_URL=https://sub.domain.com/
      - GENERIC_TIMEZONE=Europe/Berlin

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

connection lost after a few seconds and container restarting.

Information on your n8n setup

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

Hey @YaPaY7 Add these headers to your Traefik configuration

- "traefik.http.routers.n8n_app.middlewares=n8n-headers"
- "traefik.http.middlewares.n8n-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
- "traefik.http.middlewares.n8n-headers.headers.customrequestheaders.Upgrade=websocket"
- "traefik.http.middlewares.n8n-headers.headers.customrequestheaders.Connection=Upgrade"
1 Like

@Glorious thanks but did not help

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