Hi all, I have just started using n8n and it looks great! I am just having an issue with webhooks. I looked at a few other forum posts about people having 404 errors with webhooks, but they didn’t help me.
FYI: the reason there is “external” and “internal” for the traefik entrypoints is because I use gravitational teleport as a VPN substitute. Teleport access the webapp via n8n.localhost.
Any help or advice would be very much appreciated.
Describe the problem/error/question
I am using docker-compose and Traefik for my n8n deployment. I based the compose file off the example in n8n docs. However, when I try to test a webhook, I get a 404 error. I have set the “WEBHOOK_URL” environment variable. However for some reason, I just can’t get webhooks to work.
What is the error message (if any)?
Oops, couldn’t find that
404 Error
Please share your workflow
Docker compose file:
services:
traefik:
image: traefik:v2.10
restart: unless-stopped
command:
- "--log.level=DEBUG"
# linode dns ssl cert (staging)
- "--certificatesResolvers.linode_dns.acme.dnsChallenge=true"
- "--certificatesResolvers.linode_dns.acme.dnsChallenge.provider=linodev4"
- "--certificatesResolvers.linode_dns.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesResolvers.linode_dns.acme.email=<email_address>"
- "--certificatesResolvers.linode_dns.acme.storage=/letsencrypt/acme.json"
- "--providers.docker"
# "internal" entrypoint is only accessable using localhost
- "--entryPoints.internal.address=:80"
- "--entryPoints.external.address=:443"
security_opt:
- no-new-privileges:true
ports:
# "9922" is used as access from localhost
- "9922:80"
# "443" relies on dns for ssl. So no access is required for 80
- "443:443"
environment:
- "LINODE_TOKEN=<linode_api_token>"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./letsencrypt:/letsencrypt"
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
security_opt:
- no-new-privileges:true
ports:
- "127.0.0.1:5678:5678"
volumes:
- n8n_data:/home/node/.n8n
environment:
- N8N_HOST=n8n.subdomain.example.com
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://n8n.subdomain.example.com/webhooks/
- GENERIC_TIMEZONE=<timezone>
labels:
# "internal" only allows access via localhost
- "traefik.http.routers.n8n-internal.entrypoints=internal"
- "traefik.http.routers.n8n-internal.rule=Host(`n8n.localhost`)"
# "external" allows access from publicly available domain \
# idea is to limit public access to only necessary parts of container (webhooks)
- "traefik.http.routers.n8n-external.tls=true"
- "traefik.http.routers.n8n-external.entrypoints=external"
- "traefik.http.routers.n8n-external.tls.certResolver=linode_dns"
# ---------> rule is simplified for testing
- "traefik.http.routers.n8n-external.rule=Host(`n8n.subdomain.example.com`)" #&& PathPrefix(`/webhooks/`)"
- "traefik.http.routers.n8n-external.middlewares=n8n_ssl"
# middlewares are from n8n docker compose example. not sure waht they all do
- "traefik.http.middlewares.n8n_ssl.headers.SSLRedirect=true"
- "traefik.http.middlewares.n8n_ssl.headers.STSSeconds=315360000"
- "traefik.http.middlewares.n8n_ssl.headers.browserXSSFilter=true"
- "traefik.http.middlewares.n8n_ssl.headers.contentTypeNosniff=true"
- "traefik.http.middlewares.n8n_ssl.headers.forceSTSHeader=true"
- "traefik.http.middlewares.n8n_ssl.headers.SSLHost=n8n.subdomain.example.com"
- "traefik.http.middlewares.n8n_ssl.headers.STSIncludeSubdomains=true"
- "traefik.http.middlewares.n8n_ssl.headers.STSPreload=true"
volumes:
n8n_data:
Share the output returned by the last node
N/A
Information on your n8n setup
- n8n version: 1.37.3
- Database (default: SQLite): default
- n8n EXECUTIONS_PROCESS setting (default: own, main): default
- Running n8n via (Docker, npm, n8n cloud, desktop app): docker compose, treafik as proxy
- Operating system: Ubuntu 22.04
Thank you all in advance for your help and advice.