n8n-io/n8n

n8n context path (BASE_PATH?) not being set correctly

chrism417 opened this issue · 1 comments

Bug Description

I'm simply trying to configure n8n to listen at https://somedomain.com/n8n/, however no matter what env variable I set, it doesn't work.

I've tried all of the following env variables, removing the leading / and adding it back for each one.

 -e N8N_PATH=/n8n/ \
 -e N8N_EDITOR_BASE_URL=n8n/ \
 -e N8N_DIAGNOSTICS_ENABLED=false \
 -e N8N_PUBLIC_API_ENDPOINT=n8n/api \
 -e N8N_ENDPOINT_REST=n8n/rest \
 -e N8N_LOG_LEVEL=verbose \
 -e N8N_ENDPOINT_WEBHOOK=n8n/webhook \
 -e N8N_ENDPOINT_WEBHOOK_TEST=n8n/webhook-test \
 -e N8N_ENDPOINT_WEBHOOK_WAIT=n8n/webhook-wait \
 -e N8N_ENDPOINT_FORM_TEST=n8n/form-test \
 -e VUE_APP_PUBLIC_PATH=n8n/ \

With this current set of env variables, I'm getting 404s on all of the paths: /n8n/assets/*

To Reproduce

Run this with Docker:

docker volume create n8n_data

docker run -it --rm \
 --name n8n \
 -p 5678:5678 \
 -e N8N_PATH=/n8n/ \
 -e N8N_EDITOR_BASE_URL=/n8n/ \
 -e N8N_DIAGNOSTICS_ENABLED=false \
 -e N8N_PUBLIC_API_ENDPOINT=/n8n/api \
 -e N8N_ENDPOINT_REST=n8n/rest \
 -e N8N_LOG_LEVEL=verbose \
 -e N8N_ENDPOINT_WEBHOOK=/n8n/webhook \
 -e N8N_ENDPOINT_WEBHOOK_TEST=/n8n/webhook-test \
 -e N8N_ENDPOINT_WEBHOOK_WAIT=/n8n/webhook-wait \
 -e N8N_ENDPOINT_FORM_TEST=/n8n/form-test \
 -e VUE_APP_PUBLIC_PATH=/n8n/ \
 -v n8n_data:/home/node/.n8n \
 docker.n8n.io/n8nio/n8n

Go to http://localhost:5678/n8n/ with developer tools on > network and you'll see all the 404s to /n8n/assets/

Expected behavior

Going to http://localhost:5678/n8n/ brings you to the sign-in page, and therefore if I do https://somedomain.com/n8n/ it would also bring you to the sign-in page.

Operating System

Alpine Linux 3.19.1

n8n Version

1.37.0

Node.js Version

18.19.1

Database

SQLite (default)

Execution mode

main (default)

unfortunately running N8N_PATH only works with url-rewrites on a reverse-proxy in front of n8n.
Here is an example for traefik.

If it's possible for you to use a subdomain instead, please do that, since N8N_PATH has no tests, and not used by any of our instances or dev setups. Which means that even if you get it working today, there are (unfortunately) currently no guarantees that it would continue to work in the next releases.

Considering how few people use this option, we are considering deprecating it, and completely removing in the next major version.