Skip to content
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

"n8n User Auth" in "Chat Trigger" seems redirect to the wrong url when N8N_PATH is set #9082

Open
chhaj5236 opened this issue Apr 8, 2024 · 6 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@chhaj5236
Copy link

chhaj5236 commented Apr 8, 2024

Bug Description

I set N8N_PATH to "/n8n/" and set "Chat Trigger" to "n8n User Auth". Then I open "Chat Url" in a web browser, it will redirect me to http://localhost:5678/signin?redirect=http://localhost:5678/n8n/webhook/xxxx/chat, but http://localhost:5678/signin does not exist.

I checked the source code and found that "Chat Trigger" does not take N8N_PATH as the prefix when trying to check the user auth or redirecting the url.

image

I also checked http://localhost:5678/n8n/rest/login is working as expected, but http://localhost:5678/rest/login is not.

I wonder if I miss something like other environment need to be set?

To Reproduce

  1. Set environment N8N_PATH to /n8n/ and WEBHOOK_URL to http://localhost:5678/n8n/ then deploy the n8n service.
  2. Go to Workflows page and add a new workflow and a Chat Trigger node.
  3. Activate the workflow.
  4. Open Chat Trigger node, Make Chat Plublic Available and set Authentication to n8n User Auth.
  5. Copy Chat Url and open it in the web browser.
  6. The browser will redirect to the url without "/n8n/" and failed.

Expected behavior

should redirect to the Chat Window.

Operating System

n8nio/base

n8n Version

1.31.0

Node.js Version

18.19.1

Database

SQLite (default)

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Apr 9, 2024

Hey @chhaj5236,

I have created NODE-1296 as the dev ticket to look into this in more detail, Out of interest is using the n8n_path a requirement in your environment or if needed would you be able to swap to a subdomain instead?

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Apr 9, 2024
@chhaj5236
Copy link
Author

Hi @Joffcom, thanks for the feedback. It's not easy for us to apply a subdomain, n8n_path is a good feature for us to serve n8n behind a proxy by using a different sub-path.

@Joffcom
Copy link
Member

Joffcom commented Apr 9, 2024

Hey @chhaj5236,

Is that a different sub path for multiple instances? One of the chats we have had internally was around possibly removing support for n8n_path in the future as we don't see it being used that often so it would be great to understand a bit more around what you are doing with it.

@chhaj5236
Copy link
Author

@Joffcom It's not for multiple n8n instances, we have other services behind the proxy.

@javierfuentesm
Copy link

javierfuentesm commented Sep 26, 2024

@chhaj5236 I'm getting a similar issue, with the chat trigger.

In this screen, the chat works fine
image

but when I open the chat after "publishing" it, I get an error. This window is calling the localhost, but I have never used the localhost; I have always used railway

image

any idea what it can be?

I have this in the env variables
image

image

@javierfuentesm
Copy link

oh and when i put the n8n authentication i get this
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

3 participants