Nginx Proxy Manager and 2FA

Hi,
we are using VaultWarden under Nginx Proxy Manager, and it works correctly, unless we activate 2FA

With 2FA, each time someone try to connect, a red popup saying “An unexpected error occurred” appears.

In the browser console :

In the server log:

[2024-06-25 10:58:47.185][request][INFO] POST /identity/accounts/prelogin
[2024-06-25 10:58:47.186][response][INFO] (prelogin) POST /identity/accounts/prelogin => 200 OK
[2024-06-25 10:58:47.607][request][INFO] POST /identity/connect/token
[2024-06-25 10:58:47.680][error][ERROR] 2FA token not provided
[2024-06-25 10:58:47.680][response][INFO] (login) POST /identity/connect/token => 400 Bad Request
[2024-06-25 10:58:55.866][request][INFO] POST /identity/accounts/prelogin
[2024-06-25 10:58:55.866][response][INFO] (prelogin) POST /identity/accounts/prelogin => 200 OK
[2024-06-25 10:58:56.277][request][INFO] POST /identity/connect/token
[2024-06-25 10:58:56.353][error][ERROR] 2FA token not provided
[2024-06-25 10:58:56.353][response][INFO] (login) POST /identity/connect/token => 400 Bad Request

Don’t know to repair that !
Is there a custom config to put in NPM ?

I have the same issue, were you able to fix it? How?
Thank you!

Hi,
Here is how to solve this :


And in the advanced tab :

location /admin {
  return 404;
  }

location / {
  proxy_http_version 1.1;

  proxy_set_header Host $host;
  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 $scheme;

  # Disable custom error page
  error_page 404 = /404_default;
  location = /404_default {
	internal;
	# => default NGINX 404 page
  }

  proxy_pass http://xxx.xxx.xxx.xxx:80;
  }
  
location /notifications {
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $http_connection;

  proxy_set_header Host $host;
  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 $scheme;

  proxy_pass http://xxx.xxx.xxx.xxx:80;
  }