[Solved] Can't get Caddy to work with Bitwarden_rs

Hi,

I’m trying to implement bitwardenrs upon my raspberryPi4 and after trying to follow the bitwarden_rs installation notes I saw that I also needed to enable https.

Following the Enabling HTTPS link from the installation notes it recommended installing Caddy, as a reverse-proxy, which I then did. Unfortunately, I’m still trying to get my head around the concept of a reverse-proxy, so please excuse some of my perhaps mis-placed terminology.

The good news is that I’ve managed to install both Bitwardenrs and Caddy, but the bad news is that I can’t get them to work together. Bitwardenrs runs, over plain http, without Caddy running. Also, when Caddy runs (without the reverse_proxy configured) I can see its default webpage being served, via https.

I tried to implement the Caddy 2.x example but that didn’t work either. Here’s my version of /etc/caddyCaddyFile

my-domain.com www.my-domain.com {
  log {
	level INFO
	output file /var/log/caddy {
	  roll_size 10MB
	  roll_keep 10
	}
  }
  reverse_proxy localhost:80
}

I’ve searched a huge amount of sites and tried many various configs, reloads and reboots, but nothing works.

I’ve been using the following to start bitwarden:

docker run -d --name bitwarden -v /bw-data/:/data/ -p 80:80 bitwardenrs/server:latest

but it returns the following:

4930f14d7ec65660470e99830f8cf76675eecc928fef224b2eb380705ce47cd8
docker: Error response from daemon: driver failed programming external connectivity on
endpoint bitwarden (8d4765b10c8d31699f6cca05c22efb04fc4d98b223638addd2dfb4db9ab0e3b3): 
Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use.

I then tried removing -p 80:80 from the above docker command, which at least doesn’t return the above type of error, but instead the browser now returns the following error:

The page isn't redirecting properly
An error occurred during a connection to www.my-domain.com.
    This problem can sometimes be caused by disabling or refusing to accept cookies.

It feels so close and I suspect I’m missing something important, but I just can’t figure it out.

I’d really appreciate any pointers.

Cheers!

You have Caddy and bitwarden_rs both using port 80. You would need to put bitwarden_rs on a different port.

Since it sounds like you’re not familiar with the subtleties here, the Docker Compose example will probably be simplest:

Hi @jjlin

Thanks, that did the trick.

Taking your suggestion, I followed the instructions in the github link and then spent most of today crash-coursing docker to get my head around the networking aspects. I’d still like to be able to run the bitwarden docker container from command line, rather than relying on docker-compose, just so I better understand what’s going on and now I’ve got a great starting place to experiment.

Really appreciate your help.

Cheers!