# Nginx Proxy Manager and 2FA

**URL:** <https://vaultwarden.discourse.group/t/nginx-proxy-manager-and-2fa/3772>\
**Category:** Uncategorized\
**Created:** [June 25, 2024, 8:06pm UTC](https://vaultwarden.discourse.group/t/nginx-proxy-manager-and-2fa/3772 "2024-06-25T20:06:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fmunier](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@fmunier](https://vaultwarden.discourse.group/u/fmunier)\
**Post date:** [June 25, 2024, 8:06pm UTC](https://vaultwarden.discourse.group/t/nginx-proxy-manager-and-2fa/3772/1 "2024-06-25T20:06:54Z")

</div>

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:

```auto
[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 ?

---

<div class="post-metadata">

**Author:** ![LinuxFacil](https://yyz2.discourse-cdn.com/free1/user_avatar/vaultwarden.discourse.group/linuxfacil/32/1561_2.png) [@LinuxFacil](https://vaultwarden.discourse.group/u/LinuxFacil)\
**Post date:** [October 26, 2024, 3:48pm UTC](https://vaultwarden.discourse.group/t/nginx-proxy-manager-and-2fa/3772/2 "2024-10-26T15:48:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fmunier](https://avatars.discourse-cdn.com/v4/letter/f/e19b73/32.png) [@fmunier](https://vaultwarden.discourse.group/u/fmunier)\
**Post date:** [October 27, 2024, 8:21am UTC](https://vaultwarden.discourse.group/t/nginx-proxy-manager-and-2fa/3772/3 "2024-10-27T08:21:57Z")

</div>

Hi,  
Here is how to solve this :

 ![image](https://global.discourse-cdn.com/free1/uploads/vaultwarden/original/2X/9/952f9248eced6dab824d5dc37e4848e1d87b1b1e.png) ![image](https://global.discourse-cdn.com/free1/uploads/vaultwarden/original/2X/e/e7914894f2c7522688bd932362f6388d0b75e8b8.png)  
And in the advanced tab :

```auto
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;
  }

```
