Port appear in OAuth Redirect URL

Port appear in OAuth Redirect URL

Why does the n8n OAuth Redirect URL include a port number?

I want to create a credential for microsoft excel 365 .
In the config n8n give me this URL in OAuth Redirect: https://n8n.mysite.com:5678/rest/oauth2-credential/callback
I installed n8n with npm
This is my nginx config:

    server {

    server_name n8n.mysite.com;

    proxy_connect_timeout       1200;
    proxy_send_timeout          1200;
    proxy_read_timeout          90m;
    send_timeout                1200;

    client_max_body_size 5G;


    add_header Access-Control-Allow-Origin *;

    location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-Port 443;
            proxy_set_header Host $host;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_http_version 1.1;
            proxy_pass http://127.0.0.1:5678;
            chunked_transfer_encoding off;
            proxy_buffering off;
            proxy_cache off;


    }



listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/n8n.mysite.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/n8n.mysite.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
if ($host = n8n.mysite.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot


    server_name n8n.mysite.com;
listen 80;
return 404; # managed by Certbot

I have add n8n to supervisor and this is the config:

[program:n8n]
command=n8n start
user=root
autostart=true
priority=10
stdout_logfile_maxbytes=0
redirect_stderr=true
environment=N8N_BASIC_AUTH_ACTIVE="true",N8N_BASIC_AUTH_USER="test",N8N_BASIC_AUTH_PASSWORD="test",N8N_VERSION_NOTIFICATIONS_ENABLED="false",WEBHOOK_TUNNEL_URL="https://n8n.mysite.com/",VUE_APP_URL_BASE_API="https://n8n.mysite.com/",N8N_PORT="5678",N8N_PROTOCOL="https",N8N_HOST="n8n.mysite.com",EXECUTIONS_DATA_PRUNE=true,EXECUTIONS_DATA_MAX_AGE=3,N8N_LOG_LEVEL="error",EXECUTIONS_DATA_PRUNE_MAX_COUNT=100

Hi @Aymen_Kmar, welcome to the community!

I can see that you are setting the WEBHOOK_TUNNEL_URL environment variable. This environment variable is no longer supported since v1. Can you replace it with WEBHOOK_URL? This lets you set the URL used by n8n for webhooks but also for Oauth2 redirects.

2 Likes

Hi @MutedJam
The port number is no longer displayed in the URL
Thank you very much

1 Like

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