dani-garcia / vaultwarden

Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs
GNU Affero General Public License v3.0
37.3k stars 1.82k forks source link

reverse proxy config with 1.9.1 #499

Closed pew closed 5 years ago

pew commented 5 years ago

Hi,

I just upgraded bitwarden from mprasil/bitwarden:1.9.0-alpine to bitwardenrs/server:1.9.1. Now my reverse proxy can't find the backend anymore. I'm using traefik, it reports backend not found in the log files (that's it).

According to the docker-compose logs from bitwarden it's starting just fine:

bitwarden_1_a04f97bb9ef5 | [2019-06-03 09:09:55][_][INFO] 1 response: Application Headers
bitwarden_1_a04f97bb9ef5 | [2019-06-03 09:09:55][launch][INFO] Rocket has launched from http://0.0.0.0:80
bitwarden_1_a04f97bb9ef5 | [2019-06-03 09:09:55][ws][INFO] Listening for new connections on 0.0.0.0:3012.

Any significant changes between the old and new docker build mechanism? I also tried bitwardenrs/server:1.9.0-alpine which didn't work either. Reverting back to mprasil/bitwarden:1.9.0-alpine worked just fine.

MarsWarrior commented 5 years ago

@ home I'm using bitwardenrs/server:1.9.0 (Version 1.9.0-08a445e2 according to the bitwarden log) behind an Apache reverse proxy. Before that I used mprasil/bitwarden:1.9.0.

Both just work.

Not sure if that is the -alpine version you have troubles with.

Did you restart Traefik? I know from our environment @ work, that sometimes Traefik gets confused and we have to restart Traefik in order to have it recognizing all backends.

pew commented 5 years ago

Yes I restarted treafik and I did try both, alpine and non alpine.

mprasil commented 5 years ago

Not sure if that is the -alpine version you have troubles with.

The alpine version is just smaller version that has most stuff statically linked. Functionally there should be no difference.

Any significant changes between the old and new docker build mechanism?

None, they are using same Dockerfile and both are automatic builds.

I've just tried running all versions (bitwardenrs/server:1.9.0-alpine, bitwardenrs/server:1.9.1-alpine, bitwardenrs/server:1.9.1) and they all work just fine in my experience. Are you definitely using the same labels and everything else?

pew commented 5 years ago

@mprasil Yes, I really just replaced the one line with image:, pulled it and restarted. I'll try it again later on if time permits or tomorrow.

patrick-othmer commented 5 years ago

I run bitwarden behind haproxy and replaced also the image. No problem on our side.

Did you define traefik labels such traefik.frontend.rule / traefik.port? Are both containers still in the same network?

pew commented 5 years ago

@patrick-othmer Yes, this is literally the diff of my docker-compose.yml:

3c3
<     image: mprasil/bitwarden:1.9.0-alpine
---
>     image: bitwardenrs/server:1.9.1-alpine

I'll change it today and report back. Hopefully I was just too impatient with traefik (but I waited a few minutes and even restarted, so I don't think so)

pew commented 5 years ago

Well, works now:

docker-compose pull
Pulling bitwarden ... done
docker-compose up -d
Recreating bitwarden_bitwarden_1_c8f778e51638 ... done

Didn't even take a minute for traefik to recognize it. Just a bad day yesterday? Today is rather a bad day for me.. well, thank you! I'll go ahead and close this one right now since also no one else reports an issue. Thanks again.

gerroon commented 5 years ago

Apache

Do you mind telling me your apache proxy setup? I cant get it to work. I can open the main page but I get "unexpected error" when I try to login.

MarsWarrior commented 5 years ago

You can check that here, https://github.com/dani-garcia/bitwarden_rs/wiki/Proxy-examples. The main part is:

    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /notifications/hub(.*) ws://<SERVER>:3012/$1 [P,L]
    ProxyPass / http://<SERVER>:80/

    ProxyPreserveHost On
    ProxyRequests Off
gerroon commented 5 years ago

@MarsWarrior thanks that looks good