Webhook URLs - Test / Production

Hello.

We have set-up these 2 Environmental Variables

N8N_EDITOR_BASE_URL=https://n8n.domain.com
WEBHOOK_URL=https://webhooks.domain.com

The problem is that on Webhook nodes the Test URL is like that:

https://n8n.domain.com/webhook-test/f60f9637-b6aa-4475-8ae0-2912c4229246

and the Production URL is like that:

https://webhooks.domain.com/webhook/f60f9637-b6aa-4475-8ae0-2912c4229246

Why Test URL does not respect the WEBHOOK_URL variable and takes the N8N_EDITOR_BASE_URL one?

1 Like

Hi @Mulen Let me clarify this is intentional, as the test URL uses N8N_EDITOR_BASE_URL , as obv the test flows are tied to the editor session, while production URL uses WEBHOOK_URL .

I do not really recommend this but in case if you want both to be directed through one URL you can set them same like:

N8N_EDITOR_BASE_URL=https://n8n.domain.com
WEBHOOK_URL=https://webhooks.domain.com

1 Like

Thank you but i do not understand your solution.

Your example is the same as we have now.

To make the webhook use WEBHOOK_URL in Test and Production URLs we have to unset the N8N_EDITOR_BASE_URL variable

1 Like

Hi @Mulen If that did not worked, i recommend unset the WEBHOOK_URL entirely and only keep N8N_EDITOR_BASE_URL

If i keep N8N_EDITOR_BASE_URL i have to put there the webhook URL and this is not what we want. I just unset the N8N_EDITOR_BASE_URL and keep WEBHOOK_URL for the time being.

Understood @Mulen my reply back then should solve this, which states that set both URLs to same address like this:

This should work as you want both test and production URLs to use the same domain

Sorry but i do not understand your solution.

Take a look at the screenshots below

This is the compose file:

Test URL:

Production URL:

To have Test and Production URLs to be https://webhooks.domain.com we need to unset the N8N_EDITOR_BASE_URL

1 Like

Bro @Mulen i was giving an example for those domains like this is how it should be like:

And with that i did not mean you literally put n8n.domain.com and webhooks.domain.com into your compose file, put your actual URLs there your real WEBHOOK_URL not these examples it was for you to understand that like

N8N_EDITOR_BASE_URL=YOUR_N8N_DOMAIN
WEBHOOK_URL=YOUR_WEBHOOK_URL

Now understood?

1 Like

You’re just repeating yourself bud, and I agree you make no sense. The OP already has those two lines of code (if you read their original post), so repeating it is not going to help. Are you saying they should set the N8N_EDITOR_BASE_URL to be the same as the WEBHOOK_URL?

@TomM you do not need to unset anything, just set N8N_EDITOR_BASE_URL to the URL where you open the n8n UI on web and WEBHOOK_URL to the exact domain you want both test and production webhooks to use, let me know if that works. :slight_smile:

It was a test. I know that i have to put my real domains there, i just wanted to show you the functionality and how it behaves

@TomM I think he misses the point and what i am trying to say. I know he repeats the same thing and his solution is not working because it is the problem i mention we have.

@Mulen @TomM Understood. To debug that now, could please share the information:

The full environment: block from your docker-compose.yml
and the output of printenv | grep -E "N8N_HOST|WEBHOOK_URL|N8N_EDITOR_BASE_URL|N8N_PROTOCOL"inside the running n8n container

Although i misunderstood but n8n should behave like that in the given URLs, if those are set and you have restarted your container that should have worked, let me know the output from those 2 then i may be able to put some narrowing for this issue.

@Mulen I have managed to replicate your issue. I resolved this by just removing the N8N_EDITOR_BASE_URL variable entirely. Then both of the webhooks used webhook.domain.com.

N8N_EDITOR_BASE_URL shouldn’t really be needed, as the editor will default to N8N_HOST. For example, this is what mine is setup like: N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}

2 Likes

there’s some ambiguity on internal documentation and discussion on this prior here - for anyone interested - N8N_EDITOR_BASE_URL sets url for test webhooks · Issue #9030 · n8n-io/n8n · GitHub

I agree with @TomM to remove the N8N_EDITOR_BASE_URL to prevent the URL changeover - have in mind though that according to @joffcom - the WEBHOOK_URL is apparently only for hosts behind a proxy.
By setting these n8n doesn't block any routing it is expected that a reverse proxy or load balancer would be handling that

to prevent any future manipulation of the base url or proxy manipulation - N8N constructs it’s WEBHOOK_URL based on three environment variables below - you can use these within your docker compose yaml instead of it.

N8N_PROTOCOL=https
N8N_HOST=n8n.domain.com
N8N_PORT= (if needed)

Let us know how this goes for you @Mulen

3 Likes

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