Calling Webhook from another workflow with WEBHOOK_URL set and behind traefik


I am trying to call a n8n Webhook from a local instance when WEBHOOK_URL is set on my environment variables in swarm mode. http://localhost:5678 does not work neither does port 80, 443 or 5679.

I always get:

401 - "Unauthorized"

Is there maybe another port for the webhook url, which is configured on traefik or any other trick to get it working and successfully contact my webhook worker?

Test Webhooks work without problems calling them locally via http://localhost:5678/webhook-test

Hey @prononext,

Is your webhook set up to require authentication? It looks like something along the way wants you to authenticate.

Hi @Jon,

I am not using authentification. I am using the WEBHOOK_URL parameter as ENV in Docker so the webhook url is different from the n8n gui url, so when on the same machine calling localhost:5678 can reach only test webhooks or api (meaning the main n8n service) and no production webhooks or wait webhooks on the n8n webhook service.

Maybe the production webhook using WEBHOOK_URL parameter, on the n8n webhook service, is using a different port, but for that I could not find any documentation and also going through docker logs and container details, did not give me any hint.

Have you managed to GET/POST a production webhook via n8n on the same instance using WEBHOOK_URL parameter and localhost:5678?

Hey @prononext,

That is pretty much how all of my test n8n instances run, I use localhost to access it while fixing issues and all of my webhook urls go to which is sent to my laptop on port 5678 from my reverse proxy.

The 401 is a pretty standard authentication error though, What happens if you access your webhook_url does it load the main n8n instance or do you have traefik configured to only direct /webhook to your n8n instance?

I have traefik configured to direct the webhooks to the webhook worker like this:

####### - n8n Webhook
    <<: *shared
    command: ${N8N_WEBHOOK_COMMAND}
      - "traefik.enable=true"
      - "traefik.http.routers.n8n-webhook.rule=Host(`${N8N_WEBHOOK_SUBUDOMAIN}.${DOMAIN_NAME}`)"
      - "traefik.http.routers.n8n-webhook.entrypoints=websecure"
      - "traefik.http.routers.n8n-webhook.tls.certresolver=myresolver"
      - "traefik.http.middlewares.n8n-webhook.headers.SSLRedirect=true"
      - traefik.http.middlewares.n8n-webhook.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n-webhook.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n-webhook.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n-webhook.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n-webhook.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n-webhook.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n-webhook.headers.STSPreload=true

The n8n main instance in the same stack looks like this:

####### - n8n Main Process
    <<: *shared
    command: ${N8N_MAIN_COMMAND}
      - "traefik.enable=true"
      - "traefik.http.routers.n8n-main.rule=Host(`${N8N_UI_SUBDOMAIN}.${DOMAIN_NAME}`)"
      - "traefik.http.routers.n8n-main.entrypoints=websecure"
      - "traefik.http.routers.n8n-main.tls.certresolver=myresolver"
      - "traefik.http.middlewares.n8n-main.headers.SSLRedirect=true"
      - traefik.http.middlewares.n8n-main.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n-main.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n-main.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n-main.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n-main.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n-main.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n-main.headers.STSPreload=true

Hey @prononext,

Are you sure the rule is working? What happens if you just load the webhook url in your browser without the rest of the path does that show that n8n login screen?

When calling a webhook production url without the rest of the Url I get a

Cannot GET /prod

Error which confirms that the webhook url only reaches the webhook node.

When calling a test-webhook url without the rest of the url I get a

Oops, couldn’t find that
404 Error

With a go back button, which takes to the n8n login screen.

Hey @prononext,

Where is it getting /prod from?

it is defined in


Environment Variable

I wouldn’t have expected the browser to say it can’t get /prod if you didn’t include it in the url, but I also can’t see anything in your Traefik config that says if the url contains /prod it should direct to the worker.

is the difference in the setup which defines a different subdomain for the webhook worker.


ENV is from n8n and defines that internally I suppose without setting in traefic specific.

Hey @prononext,

So when you got the error about the /prod link what url did you use? Did you specify the /prod at the end?

Hi @Jon,

is “

is “

is “prod”

  • Everything works from outside the n8n domain
  • Calling any test webhook also works using “localhost:5678/webhook-test”
  • But calling any production webhook from inside the n8n instance is not possible

My goal was:

  • Starting a Workflow with a Wait Webhook inside
  • Editing another webhook on the beginning via n8n node and enter the wait webhook into the other webhooks http request node
  • when the other webhook activates it calls the before entered wait webhook url (which is not working)
  • then usually the base workflow should continue if the webhook would be callable internally

I solved this by a dirty workaround getting execution data from the other workflow instead of using the wait webhook, but thats not really reliable when many concurrent executions are there and only one is the correct one.

Hey @prononext,

Alright so when you called which I assume isn’t really the N8N_WEBHOOK_SUBDOMAIN but more the mix of N8N_WEBHOOK_SUBDOMAIN and DOMAIN_NAME in your browser and you got the Cannot GET /prod message where did the /prod come from?

Did you actually use instead?

When you say everything from outside the n8n domain what do you actually mean? Do you just mean like the 3rd option says it only actually fails when ran from inside an n8n workflow? If that is the case what is the output when you set n8n to output the full response does it show anything unexpected?

Hi @Jon maybe that clarifies it a little:

  • The Production Webhooks look like this:

h t t p s://…

  • the Test Webhooks look like this:

h t t p s://

  • The Wait Webhooks look like this

h t t p s://

Hi @prononext,

That doesn’t really answer the actual question I asked sadly. When you ented the url did you add /prod at the end or did you just use the address?

This potentially doesn’t matter though depending on the answer to the other questions I asked.

Hey @Jon,

I guess it is finally solved. As localhost is not working, because the main n8n service is not taking webhooks in this setup I finally tried using the

Docker service name directly of the webhook service.

And see there locally it worked via:

h t t p ://n8n-webhook:5678/webhook-waiting/313139…

which is public h t t p s://webhook.n8n /123123123123

and also the production webhook

h t t p ://n8n-webhook:5678/prod/313139…

which is public h t t p s://webhook.n8n /234234234…

Sorry for being unclear and glad its working now.
Thank you very much for taking the time!

1 Like

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