# Apache2 reverse proxy vaultwarden dietpi-dashboard

**URL:** https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597
**Category:** Troubleshooting
**Created:** [7 December 2023 07:31 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597 "2023-12-07T07:31:13Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![gitzjoey](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/g/22d042/32.png) [@gitzjoey](https://dietpi.com/forum/u/gitzjoey)
#### Post date: [7 December 2023 07:31 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/1 "2023-12-07T07:31:13Z")

</div>

Hi,  
so basically i want to reduce opening random port by creating some reverse proxy  
[https://DietPi:5252](https://DietPi:5252) to [https://dietpi-dashboard](https://dietpi-dashboard).[domain].[com]  
[https://DietPi:8001](https://DietPi:8001) to [https://dietpi-dashboard](https://dietpi-dashboard).[domain].[com]

can someone provide example of apache2 sites-available conf for this 2 (dietpi-dashboard and vaultwarden) ?

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [7 December 2023 07:48 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/2 "2023-12-07T07:48:09Z")

</div>

> **[Proxy examples](https://github.com/dani-garcia/vaultwarden/wiki/Proxy-examples)**
>
> Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden\_rs - dani-garcia/vaultwarden

---

<div class="post-metadata">

### Author: ![gitzjoey](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/g/22d042/32.png) [@gitzjoey](https://dietpi.com/forum/u/gitzjoey)
#### Post date: [7 December 2023 07:52 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/3 "2023-12-07T07:52:48Z")

</div>

hi @Joulinar

yes i’ve read that and tried to use the setup, but this is the best i get

```auto
<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin admin@gitzjoey.online
                ServerName vault.gitzjoey.online
                Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains;"

                RewriteEngine on
                RewriteCond %{HTTP:Upgrade} =websocket [NC]
                RewriteRule /notifications/hub(.*) ws://DietPi:3012/$1 [P,L]
                ProxyPass / https://DietPi:8001/
                ProxyPreserveHost On
                ProxyRequests Off
                RequestHeader set X-Real-IP %{REMOTE_ADDR}s

                SSLEngine on
                SSLCertificateFile /etc/letsencrypt/live/gitzjoey.online/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/gitzjoey.online/privkey.pem
        </VirtualHost>
</IfModule>

```

but i get this error in journalctl

```auto
Dec 07 19:35:14 DietPi apache2[12648]: [ssl:warn] [pid 12648:tid 281473458769952] AH01909: vault.gitzjoey.online:443:0 server certificate does NOT include an ID which matches the server name
Dec 07 19:35:36 DietPi apache2[18924]: [core:error] [pid 18924:tid 281472906367264] [remote 127.0.1.1:8001] AH01961: failed to enable ssl support [Hint: if using mod_ssl, see SSLProxyEngine]
Dec 07 19:35:36 DietPi apache2[18924]: [proxy:error] [pid 18924:tid 281472906367264] AH00961: https: failed to enable ssl support for 127.0.1.1:8001 (dietpi)
Dec 07 19:35:36 DietPi vaultwarden[4063]: [2023-12-07 19:35:36.503][rocket_http::tls::listener][WARN] tls handshake with 127.0.0.1:51250 failed: tls handshake eof
Dec 07 19:35:36 DietPi apache2[18924]: [core:error] [pid 18924:tid 281473438978336] [remote 127.0.1.1:8001] AH01961: failed to enable ssl support [Hint: if using mod_ssl, see SSLProxyEngine]
Dec 07 19:35:36 DietPi apache2[18924]: [proxy:error] [pid 18924:tid 281473438978336] AH00961: https: failed to enable ssl support for 127.0.1.1:8001 (dietpi)
Dec 07 19:35:36 DietPi vaultwarden[4063]: [2023-12-07 19:35:36.624][rocket_http::tls::listener][WARN] tls handshake with 127.0.0.1:51264 failed: tls handshake eof

```

---

<div class="post-metadata">

### Author: ![gitzjoey](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/g/22d042/32.png) [@gitzjoey](https://dietpi.com/forum/u/gitzjoey)
#### Post date: [9 December 2023 05:28 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/4 "2023-12-09T05:28:26Z")

</div>

I’ve change the config into

```auto
<VirtualHost *:443>
    SSLEngine on
    ServerName vault.gitzjoey.online

    SSLCertificateFile /etc/letsencrypt/live/gitzjoey.online/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/gitzjoey.online/privkey.pem

    ErrorLog /var/log/apache2/vaultwarden-error.log
    CustomLog /var/log/apache2/vaultwarden-access.log combined

    ProxyPass / https://DietPi:8001/ upgrade=websocket

    ProxyPreserveHost On
    ProxyRequests Off
    RequestHeader set X-Real-IP %{REMOTE_ADDR}s
    # Add this line if your url attributes are reported back as http://... :
    RequestHeader add X-Forwarded-Proto https
</VirtualHost>

```

but having issue with Rocket webservice  
in journalctl  
`[2023-12-09 13:24:24.718][rocket_http::tls::listener][WARN] tls handshake with 127.0.0.1:56740 failed: tls handshake eof`

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [9 December 2023 11:34 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/5 "2023-12-09T11:34:18Z")

</div>

Better to disable SSL within vaultwarden, as HTTPS is done by the reverse proxy now. There are a couple of descriptions within the forum how to do it.

---

<div class="post-metadata">

### Author: ![gitzjoey](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/g/22d042/32.png) [@gitzjoey](https://dietpi.com/forum/u/gitzjoey)
#### Post date: [9 December 2023 12:03 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/6 "2023-12-09T12:03:41Z")

</div>

```auto
<VirtualHost *:443>
    SSLEngine on
    ServerName vault.gitzjoey.online

    SSLCertificateFile /etc/letsencrypt/live/gitzjoey.online/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/gitzjoey.online/privkey.pem

    ErrorLog /var/log/apache2/vaultwarden-error.log
    CustomLog /var/log/apache2/vaultwarden-access.log combined

    ProxyPass / http://DietPi:8001/ upgrade=websocket

    ProxyPreserveHost On
    ProxyRequests Off
    RequestHeader set X-Real-IP %{REMOTE_ADDR}s
    # Add this line if your url attributes are reported back as http://... :
    RequestHeader add X-Forwarded-Proto https
</VirtualHost>

```

replacing the [https://DietPi](https://DietPi) into [http://DietPi](http://DietPi)  
but the rocket error keep coming, honestly not really understand about websocket in vaultwarden

```auto
vaultwarden[72386]: [2023-12-09 20:01:47.386][rocket_http::tls::listener][WARN] tls handshake with 127.0.0.1:44546 failed: received corrupt message of type InvalidContentType

```

BTW, I just crawling into DietPi-Dashboard github issues, also find some threads from @MichaIng about adding reverse-proxy ability into it

\*\*update  
just realize its stated in docs, that i need to disable rocket websocket when using reverse proxy

```auto
he examples below assume you are running in this configuration, in which case you should not enable the HTTPS functionality built into Vaultwarden (i.e., you should not set the ROCKET_TLS environment variable). If you do, connections will fail since the reverse proxy is using HTTP to connect to Vaultwarden, but you're configuring Vaultwarden to expect HTTPS.

```

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [9 December 2023 12:58 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/7 "2023-12-09T12:58:22Z")

</div>

As stated above already, you need to disable SSL within vaultwaden configuration. We have a couple of examples for different web server in our forum. Including a step by step guide.

---

<div class="post-metadata">

### Author: ![gitzjoey](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/g/22d042/32.png) [@gitzjoey](https://dietpi.com/forum/u/gitzjoey)
#### Post date: [9 December 2023 14:09 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/8 "2023-12-09T14:09:44Z")

</div>

appreciate if you can share some url/link about the step by step guide (specially for apache2)

---

<div class="post-metadata">

### Author: ![gitzjoey](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/g/22d042/32.png) [@gitzjoey](https://dietpi.com/forum/u/gitzjoey)
#### Post date: [9 December 2023 14:24 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/9 "2023-12-09T14:24:59Z")

</div>

anyway i’ve succeed  
sharing the config, for others if interested

```auto
<VirtualHost *:443>
    SSLEngine on
    ServerName vault.gitzjoey.online

    SSLCertificateFile /etc/letsencrypt/live/gitzjoey.online/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/gitzjoey.online/privkey.pem

    ErrorLog /var/log/apache2/vaultwarden-error.log
    CustomLog /var/log/apache2/vaultwarden-access.log combined

    ProxyPass / http://localhost:8000/ upgrade=websocket

    ProxyPreserveHost On
    ProxyRequests Off
    RequestHeader set X-Real-IP %{REMOTE_ADDR}s
    # Add this line if your url attributes are reported back as http://... :
    #RequestHeader add X-Forwarded-Proto https
</VirtualHost>

```

the important thing is to remarks all ROCKET websockets in vaultwarden.conf

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [9 December 2023 18:19 UTC](https://dietpi.com/forum/t/apache2-reverse-proxy-vaultwarden-dietpi-dashboard/18597/10 "2023-12-09T18:19:06Z")

</div>

> [@gitzjoey](#):
>
> url/link about the step by step guide

> [@Confused Reverse proxy and vaultwarden](https://dietpi.com/forum/t/confused-reverse-proxy-and-vaultwarden/5762/21):
>
> of course you can use docker and container like NginxProxyManager or traefik but it’s working without as well. I did a test installation on 2 RPi. I used 2 devices just for testing. It’s fine to host web server as well as vaultwarden on a single device. created a DDNS domain from a free provider activate regular DDNS update using dietpi-ddns RPi 1 is hosting web server lighttpd RPi 2 is hosting vaultwarden on RPi 2 I was going to disable HTTPS on vaultwarden nano /mnt/dietpi\_userdata/vaultwa…

Not for Apache but should be similar.
