Docker-Compose Webhook Not Working: Permissions/Environment Issue?

Describe the problem/error/question

I’m using n8n in a Docker-Compose setup with NGINX as a reverse proxy. The editor loads fine at the configured URL, and workflows can be activated, but webhooks do not respond to test events sent to the expected URL.


What is the error message (if any)?

There’s no direct error visible when testing the webhook, but the following logs were captured:

  • n8n Logs:

csharp

Copy code

Error: nodes package n8n-nodes-base is already loaded.
Please delete this second copy at path /home/node/.n8n/nodes/node_modules/n8n-nodes-base
  • NGINX Logs:

csharp

Copy code

recv() failed (104: Connection reset by peer) while reading response header from upstream

Please share your workflow

Here’s a simple workflow with a webhook trigger for testing purposes:

json

Copy code


Share the output returned by the last node

When testing the webhook, there’s no response from the endpoint, and no logs are triggered in the n8n editor.


Information on your n8n setup

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

Additional Details

Here’s the docker-compose.yml file (sanitized):

yaml

Copy code

version: "3.7"

services:
  n8n:
    image: n8nio/n8n
    ports:
      - "5678:5678"
    volumes:
      - /path/to/local/data:/home/node/.n8n
    environment:
      - N8N_PROTOCOL=https
      - N8N_HOST=example.com
      - WEBHOOK_URL=https://example.com/
    restart: unless-stopped

Here’s a snippet of the NGINX configuration for the proxy (sanitized):

nginx

Copy code

server {
    listen 80;
    server_name example.com;

    location / {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    listen 443 ssl;
    ssl_certificate /path/to/certificate.crt;
    ssl_certificate_key /path/to/private.key;
}

Hi @Exnav29

I have tried this in the past and had it working but needed to at the webbook and webhook-test as locations in the nginx config file.

Example below:


server {
    listen 80;
    server_name <your-domain>;

    location / {
    proxy_pass http://127.0.0.1:5678;
    proxy_set_header Connection 'Upgrade';
    proxy_set_header Upgrade $http_upgrade;
    proxy_http_version 1.1;
  }

    location /webhook/ {
        proxy_pass http://localhost:5678;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /webhook-test/ {
        proxy_pass http://localhost:5678;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # Error Pages
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
}

Then restart nginx and docker.

2 Likes

Thank you so much, I will give it a try!

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