OAuth Redirect URL how is it formed

Describe the problem/error/question

How is the URL build for OAuth Redirect URL.

What is the error message (if any)?

404 from the form, network tab inthe browser does not give me a 404

i have set
WEBHOOK_URL=https://app.company.com/
and
N8N_PATH=/workflow/
and
N8N_ENDPOINT_REST=workflow/rest

/workflow is forwarded by reverse proxy to n8n and removed from the url

I’mcurious how this variables act in detail for the presentation and their influence in the actual path of the endpoint which needs to be called on the n8n server.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @Martin_Forster,

The oauth redirect URL should be based on WEBHOOK_URL if set although I have not tried setting the 3 values you are using but if you have n8n under the /workflow/ path it might be worth adding that to your webhook_url and leaving the endpoint_rest to just rest and see if that helps.

without N8N_ENDPOINT_REST
and WEBHOOK_URL = https://app.company.com/workflow
i get 404 on https://app.company.com/workflow/rest/settings in the editor.

Is that still with path set to /workflow? Are you on a new version of n8n I know we did have issues with path not working correctly before, Do you also have your reverse proxy redirecting to /workflow or is it going to localhost:5678?

yes path is unchanged.
version is a bit difficult, we do embedding with whitelabeling.
“name”: “n8n”,
“version”: “1.20.0”,
from the root package.json.
reverseproxy is redirecting to http://containerip:5678
and with traefik stripprefix, i remove the /workflow from the path.

From my understanding that should work although I wonder if maybe you are seeing this: fix(editor): Fix UI urls when hosted behind a path prefix by netroy · Pull Request #8198 · n8n-io/n8n · GitHub which was fixed in 1.23.0.

hmm looks different.
i can login to editor, but it then fails to access the “rest/settings” with the url:
/workflow/rest/settings

so n8n container seems not to listen on /rest/settings
and your link seems to be editor only.
the /workflow is removed by the reverseproxy.

:thinking: That is a good point, What happens if you access the container directly does that let you use rest/settings?

that is weird i get unauthenticated all the time as answer, tried all urls which should work.
is there some check on requests if the match against the configured hostnames ?

Ok overriding the variable with empty string doesnt work.

after removal of the variable the rest endpoint ist just rest:


            window.BASE_PATH = '/workflow/';
            window.REST_ENDPOINT = 'rest';

Can you share your traefik and n8n config so I can try and reproduce this?

here you go:
environment variables:

"Env": [
1 N8N_HOST=server.domain.com
2 N8N_ONBOARDING_FLOW_DISABLED=false
3 N8N_PATH=/workflow/
4 N8N_PROTOCOL=http
5 N8N_USER_MANAGEMENT_DISABLED=false
6 WEBHOOK_URL=https://n8nembed.idfunction.com/webhook
7 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
8 NODE_VERSION=18.18.2
9 YARN_VERSION=1.22.19
10 NODE_ICU_DATA=/usr/local/lib/node_modules/full-icu
11 N8N_RELEASE_TYPE=stable
12 N8N_LOG_OUTPUT=console
13 N8N_LOG_LEVEL=debug
14 N8N_MFA_ENABLED=false
15 EXTERNAL_HOOK_FILES=/backend_hooks/hooks.js
16 NODE_ENV=production
17 GENERIC_TIMEZONE=UTC
18 N8N_TEMPLATES_ENABLED=false
19 N8N_PERSONALIZATION_ENABLED=false
20 N8N_VERSION_NOTIFICATIONS_ENABLED=false
21 N8N_DIAGNOSTICS_ENABLED=false
22 N8N_HIRING_BANNER_ENABLED=false
23 N8N_HIDE_USAGE_PAGE=true
24 N8N_LICENSE_AUTO_RENEW_ENABLED=false
25 N8N_BLOCK_ENV_ACCESS_IN_NODE=false
26 N8N_ENDPOINT_REST=workflow/rest
27 N8N_PORT=5678

and traefik:

        - traefik.enable=true
        - traefik.http.middlewares.n8nembed_wf-stripprefix.stripprefix.prefixes=/workflow
        - traefik.http.routers.n8nembed.middlewares=n8nembed_wf-stripprefix
        - traefik.http.routers.n8nembed.rule=Host(`server.domain.com`) && PathPrefix(`/workflow{regex:$$|/.*}`)
        - traefik.http.routers.n8nembed.service=n8nembed-port
        - traefik.http.routers.n8nembed.priority=76
        - traefik.docker.network=publish
        - traefik.http.services.n8nembed-port.loadbalancer.server.port=5678
        - traefik.http.services.n8nembed-port.loadbalancer.server.scheme=http
        - traefik.http.routers.n8nembed.entrypoints=https
        - traefik.http.routers.n8nembed.tls=true
        - traefik.http.routers.n8nembed.tls.certresolver=le

Can you try changing this and dropping the Regex? I was looking at an internal chat about paths and setting the PathPrefix to just PathPrefix('/workflow') seemed to be the solution.

regex is not is not relevant.
works with regex.
i had to set the variables like that:

Which is valid in my usecase.

1 Like

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