Skip to content

N8N_EDITOR_BASE_URL sets url for test webhooks #9030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lawfulsoftware opened this issue Apr 3, 2024 · 2 comments
Closed

N8N_EDITOR_BASE_URL sets url for test webhooks #9030

lawfulsoftware opened this issue Apr 3, 2024 · 2 comments

Comments

@lawfulsoftware
Copy link

lawfulsoftware commented Apr 3, 2024

Bug Description

WEBHOOK_URL sets the base URL for production webhooks
N8N_EDITOR_BASE_URL sets the base URL for test webhooks as well as the base URL for the REST API
N8N_HOST sets the URL of the UI

This has existed for a long time.

To Reproduce

My Configuration

Set N8N_HOST=n8n.domain.com
Set N8N_EDITOR_BASE_URL=https://webhook.domain.com
Set WEBHOOK_URL=https://webhook.domain.com

Production webhooks use: https://webhook.domain.com/webhook
Test webhooks use: https://webhook.domain.com/webhook-test
REST API uses: https://webhook.domain.com/rest

UI can be accessed from both https://webhook.domain.com and https://n8n.domain.com

Expected Proper Configuration

Set N8N_HOST=n8n.domain.com
Set N8N_EDITOR_BASE_URL=https://n8n.domain.com
Set WEBHOOK_URL=https://webhook.domain.com

Production webhooks use: https://webhook.domain.com/webhook
Test webhooks use: https://n8n.domain.com/webhook-test
REST API uses: https://n8n.domain.com/rest

UI can be accessed from both https://webhook.domain.com and https://n8n.domain.com

Expected behavior

WEBHOOK_URL should set the base URL for all webhooks.
UI should only be accessible from N8N_EDITOR_BASE_URL

Operating System

n8nio/n8n:1.35.0

n8n Version

n8nio/n8n:1.35.0

Node.js Version

n8nio/n8n:1.35.0

Database

PostgreSQL

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Apr 5, 2024

Hey @lawfulsoftware,

Looking at this I would say it is working as expected, n8n_host is used to set the hostname n8n runs on and is used as a fallback if webhook_url is not set. (https://docs.n8n.io/hosting/configuration/configuration-examples/webhook-url/)

webhook_url is used to define the path to webhooks when running n8n behind a reverse proxy and n8n_editor_base_url is used to set the url used in email notifications.

By setting these n8n doesn't block any routing it is expected that a reverse proxy or load balancer would be handling that so on your reverse proxy you would to only allow /webhook/* traffic on your webhook_url and on your n8n_editor_base_url you would allow everything else including /webhook-test/* as test webhooks always need to hit the editor so you can see the result.

For now as this appears to be working as expected I am going to mark this as closed but let me know if you have any other questions on this one.

@Joffcom Joffcom closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2024
@lawfulsoftware
Copy link
Author

Thank you @Joffcom .

I understand your explanation that test webhooks need to hit the editor and, while this makes sense, it is not expected given the current documentation.

The description for WEBHOOK_URL is "Used to manually provide the Webhook URL when running n8n behind a reverse proxy. See here for more details." The more details page does not clarify the behaviour.

The description for N8N_EDITOR_BASE_URL is "Public URL where users can access the editor. Also used for emails sent from n8n."

Your explanation as to why N8N_EDITOR_BASE_URL is used for test webhooks and the fact that WEBHOOK_URL does not set the webhook URL for test webhooks should probably be added to the documentation. @StarfallProjects

A simpler approach from the user's perspective would be to use WEBHOOK_URL for all webhooks and internally route any requests to N8N_ENDPOINT_WEBHOOK_TEST to the editor. I realise, however, that this approach would be more difficult to implement and there could be some further considerations that might militate against it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants