Redirect http to https whe using proxy

When deploying a self hosted deployment of bitwarden and having a proxy infront of the deployment performing ssl offload, an option to have the nginx container to redirect x-forwarded-proto from http to https if the proxy sends traffic from port 80 to the internal http port.

Proxy example with port 8080 and 8443:

http://bitwarden.domain.comhttp://localhost:8080 (redirect to https)

nginx code:

server {
listen 8080;
server_name bitwarden.domain.com;
return 301 https://$server_name$request_uri;
}

https://bitwarden.domain.comhttp://localhost:8443

Proxy example with port 8080 only

http://bitwarden.domain.comhttp://localhost:8080 (redirect to https)

nginx code:

if ($http_x_forwarded_proto != “https”) {
rewrite ^ https://$http_host$request_uri? permanent;
}

https://bitwarden.domain.comhttp://localhost:8080

Couldn’t you just configure your proxy to always redirect to the localhost https port? This is what we expect users to do currently.

As discussed in https://github.com/bitwarden/core/issues/244
Using Synology DSM their implementation of application reverse proxy does not offer any redirect options.

That being said, this use case is specific to Synology and you may choose not to support it, but the feature request was provided for consideration.

I believe synology uses nginx under the hood so someone inclined to do so could attempt modifying the nginx config that synology creates or create their own (this may be an issue when updates occur though).

Having an option for the bitwarden-nginx container config to have a redirect to https seems like a potential solution to this use case.

As well since providing the option to set the base url to https:// when the users proxy is using SSL (https://github.com/bitwarden/core/issues/248) seems like a good solution and to close port 80 all together. This could be the recommended design strategy with Synology DSM implementation.

I’d say this feature request is more of a place holder to see if others agree with the need for redirects at the bitwarden-nginx level.