Running with Docker under NGINX Proxy results in malformed webpage #4571

Closed
opened 2026-03-07 19:52:47 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @hwittenborn on GitHub (Feb 11, 2021).

Subject of the issue

As per the title, I'm trying to run the docker image for bitwarden_rs, with request being brought from an NGINX reverse proxy. When accessing the page from the proxy, several details are missing, but if I do a direct connect to the container via it's published port, it looks just fine.

Your environment

  • Bitwarden_rs version: 1.19.0
  • Install method: Docker image
  • Clients used: Web/Firefox
  • Reverse proxy and version: NGINX 1.18.0
  • Version of mysql/postgresql: N/A
  • Other relevant information:

Images:
NGINX:
Screenshot from 2021-02-10 23-29-30

Directly to container:
Screenshot from 2021-02-10 23-29-28

**docker-compose.yml**
version: "3.5"
services:
  bitwarden:
    container_name: bitwarden
    image: bitwardenrs/server:latest
    restart: unless-stopped
    networks:
      - bitwarden
    ports:
      - REDACTED:80
    volumes:
      - REDACTED:/data
    environment:
      DOMAIN: 'REDACTED'
      SIGNUPS_ALLOWED: 'false'
      INVITATIONS_ALLOWED: 'false'
networks:
  bitwarden:
    name: REDACTED

**NGINX**
server {
  server_name REDACTED;
  location / {
    proxy_pass http://localhost:REDACTED;
    }
*continues with default certbot config* ```
Originally created by @hwittenborn on GitHub (Feb 11, 2021). <!-- # ### NOTE: Please update to the latest version of bitwarden_rs before reporting an issue! This saves you and us a lot of time and troubleshooting. See: https://github.com/dani-garcia/bitwarden_rs/issues/1180 # ### --> <!-- Please fill out the following template to make solving your problem easier and faster for us. This is only a guideline. If you think that parts are unnecessary for your issue, feel free to remove them. Remember to hide/obfuscate personal and confidential information, such as names, global IP/DNS addresses and especially passwords, if necessary. --> ### Subject of the issue <!-- Describe your issue here.--> As per the title, I'm trying to run the docker image for bitwarden_rs, with request being brought from an NGINX reverse proxy. When accessing the page from the proxy, several details are missing, but if I do a direct connect to the container via it's published port, it looks just fine. ### Your environment <!-- The version number, obtained from the logs or the admin diagnostics page --> <!-- Remember to check your issue on the latest version first! --> * Bitwarden_rs version: 1.19.0 <!-- How the server was installed: Docker image / package / built from source --> * Install method: Docker image * Clients used: <!-- if applicable --> Web/Firefox * Reverse proxy and version: <!-- if applicable --> NGINX 1.18.0 * Version of mysql/postgresql: <!-- if applicable --> N/A * Other relevant information: <!-- Share some logfiles, screenshots or output of relevant programs with us. --> **Images:** NGINX: ![Screenshot from 2021-02-10 23-29-30](https://user-images.githubusercontent.com/74838472/107605493-ea2fe180-6bf8-11eb-8e1a-744358b58b40.png) Directly to container: ![Screenshot from 2021-02-10 23-29-28](https://user-images.githubusercontent.com/74838472/107605512-f9af2a80-6bf8-11eb-8b74-b6a5ae07549a.png) -- ``` **docker-compose.yml** version: "3.5" services: bitwarden: container_name: bitwarden image: bitwardenrs/server:latest restart: unless-stopped networks: - bitwarden ports: - REDACTED:80 volumes: - REDACTED:/data environment: DOMAIN: 'REDACTED' SIGNUPS_ALLOWED: 'false' INVITATIONS_ALLOWED: 'false' networks: bitwarden: name: REDACTED **NGINX** server { server_name REDACTED; location / { proxy_pass http://localhost:REDACTED; } *continues with default certbot config* ```
Author
Owner

@reinob commented on GitHub (Feb 11, 2021):

Your reverse proxy config looks incomplete.
Why don't use use the one in https://github.com/dani-garcia/bitwarden_rs/wiki/Proxy-examples (Nginx, by shauder).
This works just fine on my Raspberry Pi 4 (running debian).

@reinob commented on GitHub (Feb 11, 2021): Your reverse proxy config looks incomplete. Why don't use use the one in https://github.com/dani-garcia/bitwarden_rs/wiki/Proxy-examples (Nginx, by shauder). This works just fine on my Raspberry Pi 4 (running debian).
Author
Owner

@hwittenborn commented on GitHub (Feb 11, 2021):

I added the following to location /, still no luck --
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;

I also added this part; again, no luck.
location /notifications/hub/negotiate {
proxy_pass http://<SERVER>:80;
}

I've omitted everything else as it doesn't seem to be of any value to me.

I do remember it working before with the "minimal config" I had set - but when I changed some DNS settings in Cloudflare(changed it from proxying to direct connection) all these issues started popping up. For some reason though this kind of issue is only happening with bitwarden_rs and nothing else I'm running.

@hwittenborn commented on GitHub (Feb 11, 2021): I added the following to `location /`, still no luck -- ` 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;` I also added this part; again, no luck. ` location /notifications/hub/negotiate {` ` proxy_pass http://<SERVER>:80;` ` }` I've omitted everything else as it doesn't seem to be of any value to me. I do remember it working before with the "minimal config" I had set - but when I changed some DNS settings in Cloudflare(changed it from proxying to direct connection) all these issues started popping up. For some reason though this kind of issue is only happening with bitwarden_rs and nothing else I'm running.
Author
Owner

@hwittenborn commented on GitHub (Feb 12, 2021):

Checking a few things now, and it appears the issue is happening when returning to Cloudflare as well - I guess something was just cached or something, and thus hiding the problems from me for a while.

@hwittenborn commented on GitHub (Feb 12, 2021): Checking a few things now, and it appears the issue is happening when returning to Cloudflare as well - I guess something was just cached or something, and thus hiding the problems from me for a while.
Author
Owner

@hwittenborn commented on GitHub (Feb 12, 2021):

Some more stuff:
The admin page is also all janky - it's like something isn't loading or something. All I get is HTTP 200 codes in the Firefox Dev Console, but I'm also noticing the following directories aren't available through NGINX(but are through a direct connection):

/app/vendor.db46b82e007a606bb83b.js
/app/main.db46b82e007a606bb83b.js

Still can't think of why in all of this though

@hwittenborn commented on GitHub (Feb 12, 2021): Some more stuff: The admin page is also all janky - it's like something isn't loading or something. All I get is HTTP 200 codes in the Firefox Dev Console, but I'm also noticing the following directories aren't available through NGINX(but are through a direct connection): `/app/vendor.db46b82e007a606bb83b.js` `/app/main.db46b82e007a606bb83b.js` Still can't think of why in all of this though
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vaultwarden#4571