Confused Reverse proxy and vaultwarden

Hi!
I am trying to configure lighttpd as a reverse proxy as [Joulinar] and [IIMustangII1151] described very clearly but lighttpd doesn’t seem to work.

When i am trying to access domain.com/vault/ I get back a “404 Not Found” page…

The steps I followed:
(On a raspberry pi 4; model b. [DietPi: ARMv8])

  • install vaultwarden, lighttpd
  • install nextcloud
  • I already have a domain in no-ip. My domain is like: subdomain.freedynamicdns. net
  • I have already configured DDNS on my Router, not on my Pi.
  • I created cers with dietpi-letsencrypt. (Force redirect http->https : ON. HSTS: OFF, OCSP: OFF)

I have configured my router to open ports 443, 80 (tcp & udp) and map with Pi’s mac address same ports (443 , 80)

Then:

nano /mnt/dietpi_userdata/vaultwarden/vaultwarden.env

I changed the following things as:

P_HEADER=X-Forwarded-For
WEBSOCKET_ENABLED=true
WEBSOCKET_ADDRESS=0.0.0.0
WEBSOCKET_PORT=3012
DOMAIN=https://subdomain.freedynamicdns.net
#ROCKET_TLS={certs="./cert.pem",key="./privkey.pem"}

Then:

nano /etc/lighttpd/conf-available/10-proxy.conf
$HTTP["host"] == "subdomain.freedynamicdns.net" {
    $HTTP["url"] =~ "^/notifications/hub($|/)" {
       # WebSocket proxy
       proxy.server = ( "" => ("vaultwarden" => ( "host" => "***192.168.pi.ip***", "port" => 3012 )))
       proxy.forwarded = ("for" => 1 )
       proxy.header = (
           "upgrade" => "enable",
           "connect" => "enable"
       )
    } else {
    $HTTP["url"] =~ "^/vault($|/)" {
       proxy.server = ( "" => ("vaultwarden" => ( "host" => "***192.168.pi.ip***", "port" => 8001 )))
       proxy.forwarded = ("for" => 1 )
       }
    }
}

Then I restarted the two services.

When I hit h-t-t-p-s://subdomain.freedynamicdns.net I get lighttpd landing page.

Also I can access next cloud at h-t-t-p-s://subdomain.freedynamicdns.net/nextcloud without any problem.

I can assume that everything related to lets-encrypt and ddns works fine.

I can access my vaultwarden at raspberry pi’s ip: h-t-t-p-://192.168.pi.ip:8001 so vaultwarden is up and running.

But when I am trying to access h-t-t-p-s://subdomain.freedynamicdns.net/vault/ I get the error page:

image

(where subdomain is my domain)

I followed these instructions to try fix the error : Fix lighttpd 404 not found error

So I added on /etc/lighttpd/lighttpd.conf :

server.max-fds = 2048

#directory listing
dir-listing.activate = "enable"
dir-listing.hide-dotfiles = "enable"
dir-listing.encoding = "utf-8"

But the result is the same.

I tried to be as specific as I can during the whole configuration.
h-t-t-p-s format is because the forum rules do not permit more than one links.
I am also not sure if I have to rewrite something else. For example if I should replace $HTTP[“host”] with $HTTP[“something-else”]

Can anyone help me or guide me on how to investigate the issue?
Thank you in advance