Webhooks are unresponsive

This seems to be a pretty common issue but I haven’t been able to fix it yet by reading some other posts.

I am runniing n8n via docker compose on n8n.example.com subdomain. I have cloudflare pointed to proxy traffic to the server and I have nginx set up as a reverse proxy.

Nginx conf

server {
	listen 443 ssl;
	server_name n8n.webvitals.bot n8n.webvitals.bot;
	client_max_body_size 10M;
	
        ssl_certificate /etc/keys/cert.pem;
        ssl_certificate_key /etc/keys/priv.pem;


        location / {
                proxy_pass http://127.0.0.1:5678;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
        }
}

This works and I can access the interface from my browser. Setting a webhook trigger works until I go to test it. Sending a test request doesn’t get registered by n8n and pressing “Stop listening” for test events also does not work.

My docker compose file

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

  n8n:
    image: docker.n8n.io/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
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - n8n_data:/home/node/.n8n
      - /local-files:/files

volumes:
  traefik_data:
    external: true
  n8n_data:
    external: true

Does it have to do with Cloudflare proxying perhaps?

n8n version: 1.39.1
database: default sqlite
os: Debian 12

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:

Hey, @victorb, just remove the proxying option on Cloudflare and try. In my installation, which is very similar to yours, I don’t use the Cloudflare proxy, and everything works just fine.

That’s not really an option sadly. I have blacklisted all ip addresses that are not in Cloudflare’s ranges on the server (this is to prevent any traffic aside from the web apps that are running via Cloudflare).

Surely there must be a fix, maybe it has something to do with the certificates that come with n8n?

Hey @victorb,

The issue is likely to be with your nginx proxy as it doesn’t include the options needed for websockets.

I would also remove the traefik service as you are not using it.

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