Confused Reverse proxy and vaultwarden

let’s summarize

  • I install nextcloud and vaultwarden


  • using web server lighttpd


  • I create a domain in duckdns


  • enable DDNS with dietpi-ddns


  • create cert with dietpi-letsencrypt and enable HTTPS


nano /mnt/dietpi_userdata/vaultwarden/vaultwarden.env

change the following things

IP_HEADER=X-Forwarded-For
WEBSOCKET_ENABLED=true
WEBSOCKET_ADDRESS=0.0.0.0
WEBSOCKET_PORT=3012
DOMAIN=> https://domain.com
#ROCKET_TLS={certs=“./cert.pem”,key=“./privkey.pem”}


nano /etc/lighttpd/conf-available/10-proxy.conf

I put this code on this one, remembering to put the IP of your dietpi

$HTTP["host"] == "domain.com" {
    $HTTP["url"] =~ "^/notifications/hub($|/)" {
       # WebSocket proxy
       proxy.server = ( "" => ("vaultwarden" => ( "host" => "192.168.0.x", "port" => 3012 )))
       proxy.forwarded = ("for" => 1 )
       proxy.header = (
           "upgrade" => "enable",
           "connect" => "enable"
       )
    } else {
    $HTTP["url"] =~ "^/vault($|/)" {
       proxy.server = ( "" => ("vaultwarden" => ( "host" => "192.168.0.x", "port" => 8001 )))
       proxy.forwarded = ("for" => 1 )
       }
    }
}

the access will be like this

domain.com/nextcloud
domain.com/vault/ (last slash MUST)

restart and it will be working

With this you will have access to both services anywhere without opening any port on your router

2 Likes