mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-03-12 01:45:56 -05:00
Reverse proxy in subdirectory results in http 500 #34
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lord-carlos on GitHub (Jul 11, 2018).
Hallo
Is it possible to run bitwarden_rs behind a reverse proxy in a subdirectoy?
Like
mydomain.tld/bitwarden?If I try I get errors:
Because rocket things I want to access
/bitwarden.From other services I'm used to set a http header to let the application know. Something possible here?
Thanks for reading :)
@mprasil commented on GitHub (Jul 11, 2018):
Can you perhaps share relevant part of your proxy configuration? It should definitely be possible with the API, I'm not 100% sure about the Valut interface and client apps, but I think it should work as well. (as long as you set proper API URL in the client) You might just need to rewrite the URL on the proxy side. Here's how you can do that with nginx.
@dani-garcia commented on GitHub (Jul 11, 2018):
The Rocket web server doesn't allow to change the server root directory, at least without modifiyng the code.
I also remember seeing somewhere that the web vault is hardcoded to the root directory. So there is a chance that it's not going to work, even with the URL rewriting.
The easiest way would be to run the instance under a subdomain, like
bitwarden.mydomain.tld. Is that an option to you?@lord-carlos commented on GitHub (Jul 11, 2018):
rewrite /bitwarden/(.*) /$1 break;starts a new can of worms. The index page works, but it tries to getjs/settings.jsfrom the root again. I can add some rules for that.But then other stuff fails. (bootstrap, agular etc.) Not sure how to rewrite that.
@dani-garcia
I'm already on a subdomain, as I only got a dyndns for my homeserver. Not sure if lets encrypt supports sub sub domains? Anyhow, then I have to do stuff with lets encrypt again. Might just directly open bitwarden to the outside on another port.
@mprasil commented on GitHub (Jul 11, 2018):
I wonder if this won't fix your issue with Vault and rewrite?
Have you tried to configure Android or some other client with the API in the subdirectory? (and with rewrite in place)
@lord-carlos commented on GitHub (Jul 16, 2018):
Hi and thanks for the quick replays.
No, I have not tested the API yet.
href=""might do it. But that's not going to help me with bitwarden_rs I assume? Or make a rewrite for it? Could not make it work, but will take a look at it when I get the time. Else I will just have to use another port ;-) Or use ~the cloud~@mprasil commented on GitHub (Jul 17, 2018):
I think the only problem with this is that the clients expect the API to be at certain path. The above linked issue will only (maybe) resolve the problem with vault, but if any other apps expect the API to be present at
/apithere's nothing we can do on our side unfortunately.I'm going to close this now as we established, that you can rewrite the URL on the proxy side so there's not much else we need to do here. It probably still won't work but that's due to client-side restriction. Feel free to reopen or create new issue if you think there's anything we can do.
@smacz42 commented on GitHub (Feb 19, 2019):
As long as the subdirectories are proxied to the server, it seems to work. I have no other service that makes calls on
/api, so I forwarded those (as well as/identity) to the bitwarden instance.For instance, here is the relevant bits of my nginx config after trying it out a bit and tailing the log to find which calls were being generated:
Preliminary testing of creating an account, logging in, creating a new entry, and retrieving that entry with both the Android and web clients was successful. I'd be interested if the devs know of any other functionality that would be worthwhile to test.
@mprasil commented on GitHub (Feb 19, 2019):
@smacz42, I think this is interesting middle ground where the API itself is still exposed on
/apiwhere Vault is expecting it while having the rest of the service (like the Vault files or admin) in sub-url. I guess that would be a solution for a lot of people that want to have different applications on the same domain as long as no other application needs/apifor its own functionality.@smacz42 commented on GitHub (Apr 4, 2020):
FWIW, after upgrading to 1.14.X the workaround above is no longer necessary. The web application correctly redirects all of the base urls (
/api,/identity,/notifications) correctly. All that is necessary is the first location block.@jjlin commented on GitHub (Apr 4, 2020):
You still need to separately proxy
/notifications/hubto port 3012 if you want WebSocket notifications to work, though.