Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run locally at suburl #241

Closed
skug67 opened this issue Nov 6, 2018 · 8 comments · Fixed by #868
Closed

Run locally at suburl #241

skug67 opened this issue Nov 6, 2018 · 8 comments · Fixed by #868

Comments

@skug67
Copy link

skug67 commented Nov 6, 2018

I'm running bitwarden_rs locally (i.e., not in a docker container) and using Apache as reverse proxy via a suburl from my main web-facing domain name. The setup was comparatively easy -- just adding the url prefix to the "mount" commands in main.rs got me 98% of the way there. I then had to customize web-vault source in a couple of places -- the baseUrl in jslib/src/services/api.service.ts, and the urls for api and identity in src/app/services/services.module.ts.

At that point I pretty much had a usable system. But immediately post-login there was a post request sent to "hub/negotiate" instead of to "/hub/negotiate" As far as I can tell this call is coming from line 20 of api/notifications.rs. But I can't figure out why it's not respecting the previously defined url prefix from the mount command on line 57 of main.rs [in my setup now = .mount("//notifications", api::notifications_routes())]

I'm working around it for now by just using apache to redirect /hub/negotiate to /hub/negotiate. But I'd love to figure out how to solve the problem internally to bitwarden_rs.

Thanks in advance for any advice. And thanks a million for a great project.

@dani-garcia
Copy link
Owner

If the post request is sent to the wrong URL, then the problem is probably from the web vault config.
Make sure you are also setting the notificationsUrl along the baseUrl from the services.module.ts file.

You can check the set-vault-baseurl.patch file inside the docker folder, which is the changes to the web vault that are applied to the docker version.

@skug67
Copy link
Author

skug67 commented Nov 6, 2018

Yup. Just needed to add my prefix at line 24 of your patch and everything works perfectly.

@skug67 skug67 closed this as completed Nov 6, 2018
@mprasil
Copy link
Contributor

mprasil commented Nov 6, 2018

@skug67 if you ever want to document your efforts, a PR with some *.md file would be very welcome.

@skug67
Copy link
Author

skug67 commented Nov 6, 2018 via email

@skug67
Copy link
Author

skug67 commented Nov 6, 2018

Posted that last comment via email and looks like not all the attachments came through (just validating my claim of non-existent git skills). Posting them via the web interface now..... (all with .txt extension added to make the interface accept them).
jslib.diff.txt
bitwarden-apache.conf.txt
web-vault.diff.txt
bitwarden_rs.diff.txt

@gerroon
Copy link

gerroon commented Apr 27, 2019

Hi

Is it this implemented and usabe in Apache atm? I am in need to running Bitwarden behindn Apache as a subfolder.

thanks

@dani-garcia
Copy link
Owner

You'll need to apply the patches included in the previous comment, which would require compiling the web vault and bitwarden_rs by yourself. We could include an option to change the prefix which would keep you from having to compile bitwarden_rs, but there is not much we can do about the web vault itself.

@gerroon
Copy link

gerroon commented Apr 27, 2019

Thanks, one reason I do not want to run this under a subdomain is that it is much easier for an attacker to discover the service than hiding behind a folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants