I have setup a N8N instance behind a NGINX reverse proxy, routing to a base path of /n8n. I have set N8N_PATH=/n8n accordingly and can access my n8n instance by navigating to
Everything is working fine except when navigating to /n8n while unauthenticated, I am redirected to a signin page which appends a redirect query string param of localhost/n8n/signin?redirect=%25fn8n. Because of this, when logging in, I am then redirected to localhost/n8n/n8n, which results in a 404.
I am trying to determine how to get N8N to resolve this redirect correctly in this scenario. Is there a specific header or something that N8N uses to compute this redirect? Thx!
Running latest docker version of n8nio/n8n
Hi @axdp944, welcome to the community
I am sorry you’re having trouble. To be honest, my personal suggestion would be to simply using a designated sub-domain for n8n - it’s much simpler and causes less headaches.
That said, the behaviour you describe does not sound right to me. Perhaps @mutasem can clarify how the web app handles such redirects (and how to avoid the problem you are encountering)?
Hello. The logic to set the redirect is here and to follow the redirect is here. Seems this logic does not consider the base path and should be updated to respect it when setting the redirect.
I see. Thanks. I appreciate the response.
Kind of a shame that the N8N_PATH isn’t respected in the redirect, but w/ this info in mind, I’ll look into deploying on the root of a separate subdomain.
Thx again for the assistance!
I’m curious @axdp944 , what’s your usecase?
Basically, we’re setting up a N8N instance on K8s on a shared domain “example.company.com” with the intention of routing N8N traffic to example.company.com/n8n. Originally, we had some difficulty getting the nginx ingress to rewrite to N8N container at / so after digging through your forums, we saw a recommendation to set the N8N_PATH=/n8n to match our route with the appropriate rewrite rule. This worked fine in every way except for the redirect on login which resulted in the redirect after login going to example.company.com/n8n/n8n.
Oops, sorry for the delayed reply. Thanks a lot - that is helpful to know; also great to have written here for posterity so we have the context. Cheers!
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.