# Confused Reverse proxy and vaultwarden

**URL:** https://dietpi.com/forum/t/confused-reverse-proxy-and-vaultwarden/5762
**Category:** General Discussion
**Created:** [24 September 2021 11:53 UTC](https://dietpi.com/forum/t/confused-reverse-proxy-and-vaultwarden/5762 "2021-09-24T11:53:36Z")
**Posts on this page:** 1
**Showing post:** 45

<div class="post-metadata">

### Author: ![IIMustangII1151](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/i/a587f6/32.png) [@IIMustangII1151](https://dietpi.com/forum/u/IIMustangII1151)
#### Post date: [31 December 2021 06:32 UTC](https://dietpi.com/forum/t/confused-reverse-proxy-and-vaultwarden/5762/45 "2021-12-31T06:32:09Z")

</div>

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  
  
  

```plaintext
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](https://domain.com)  
> #ROCKET\_TLS={certs=“./cert.pem”,key=“./privkey.pem”}

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

```

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

```plaintext
$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](http://domain.com/nextcloud)  
[domain.com/vault/](http://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

---

_[View the full topic](https://dietpi.com/forum/t/confused-reverse-proxy-and-vaultwarden/5762)._
