Stuck after new user registration (POST to /rest/owner/setup returns 200, but no login)

Describe the problem/error/question

I’m having a persistent issue setting up a new n8n instance and would appreciate any help. I’ve been troubleshooting for a very long

time and have exhausted all standard options.

What is the error message (if any)?
Problem:
When I set up a new instance, I get to the owner registration page. I fill in my details and click “Next”. The progress bar on the
button spins indefinitely.

Checking the Nginx access logs, I can see that the request is successful:
POST /rest/owner/setup HTTP/1.1" 200

However, the browser is not logged in, and any subsequent requests fail with a 401 error. If I refresh the page, I’m taken to the login
screen, but the credentials I just created don’t work (the login attempt also hangs or fails silently).

Environment:
* OS: Fedora
* n8n Version: 1.104.1
* Installation: Docker Compose
* Proxy: Nginx

Key Log Entry:
At one point during troubleshooting, I saw this error in the n8n container logs, which seems to be the root cause, but I have been
unable to fix it:
ValidationError: The ‘X-Forwarded-For’ header is set but the Express ‘trust proxy’ setting is false (default).

My Current `docker-compose.yml`:

1 services: 
2   n8n: 
3     image: n8nio/n8n:latest 
4     restart: always 
5     network_mode: host 
6     environment: 
7       - N8N_URL=http://n8n.albion1.ru 
8       - N8N_SECURE_COOKIE=false 
9       - N8N_RATE_LIMIT_DISABLED=true # This was a diagnostic attempt 

10 volumes:
11 - ./n8n_data:/home/node/.n8n

My Current Nginx `n8n.conf`:

1 server { 
2     listen 80; 
3     server_name n8n.albion1.ru; 
4  
5     location / { 
6         proxy_pass http://127.0.0.1:5678; 
7         proxy_http_version 1.1; 
8         proxy_set_header Upgrade $http_upgrade; 
9         proxy_set_header Connection 'upgrade'; 

10 proxy_set_header Host $host;
11 proxy_set_header X-Real-IP $remote_addr;
12 # I have tried with and without this next line
13 # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14 proxy_set_header X-Forwarded-Proto $scheme;
15 }
16 }

Things I have tried:
* Every possible combination of N8N_HOST, N8N_PROTOCOL, N8N_URL, N8N_TRUST_PROXY=true, N8N_TRUST_PROXY=‘127.0.0.1’.
* Switching between Docker’s bridge and host network modes.
* Completely clearing the database (database.sqlite) before each attempt.
* Always using a new Incognito window to test.
* Disabling express-rate-limit with N8N_RATE_LIMIT_DISABLED=true.

Nothing has worked. The behavior is always the same. Any ideas would be greatly appreciated. Thank you!

Please share your workflow

(Select thea nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

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

Hi @gvingm Thanks for the details.

Have you tried adding N8N_PROXY_HOPS to your env options and setting the value to 1 and seeing if that helps , metioned in : Hestiacp Nginx proxy template file error - #6 by Nuno

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