-
Notifications
You must be signed in to change notification settings - Fork 72
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
bag-database behind a proxy #103
Comments
Right now, it's a little bit of a pain to have a reverse proxy serve it from a different application root. The easiest way to handle this is probably to build your own Docker image that serves the application from the same path that you want to serve through your proxy. I think you'll need to:
There's probably a better way to fix this so that server handles setting its application path based on the headers in the proxy requests, but that's the best I've come up with in about an hour of investigation. |
Hello and thanks a lot for your answer, |
I know Apache can be pretty picky when it comes to trailing slashes; does changing the location to |
Yes, that makes a huge difference :) now most of the page gets redirected, only the websockets are still not working |
Ok, cool. I believe that you can use mod_rewrite to proxy websocket requests based on their headers; for example, this configuration is working for me: <Location /bag>
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule .* "ws://localhost%{REQUEST_URI}" [P]
ProxyPass http://localhost:8080/bag
ProxyPassReverse http://localhost:8080/bag
</Location> Here's some more documentation on how that works: https://www.happyassassin.net/2018/11/23/reverse-proxying-websockets-with-apache-a-generic-approach-that-works-even-with-firefox/ |
Still it does give me an error: I even added in the apache config: strange part is: the page seems to work. |
If you're seeing POST requests in the log, that probably means that the rewrite rule conditions are probably not matching properly, and the connection is not being upgraded to a web socket properly. Could you paste what your Apache config looks like now? The websocket is used for the status bar at the bottom of the page; normally, when you add new bag files, it displays status updates there when it either successfully parses them or when it encounters errors. If the websocket isn't working, it's actually not a big deal, you will just have to reload the page in order to see any status messages. |
<VirtualHost *:443 >
|
Ah, I think you're missing a RewriteRule. Also, the second ProxyPass/ProxyPassReverse directives are probably unnecessary. Try this: <Location /bag>
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule .* "ws://localhost%{REQUEST_URI}" [P]
ProxyPass http://localhost:8080/bag
ProxyPassReverse http://localhost:8080/bag
</Location> |
Ah, must have been lost while trying around |
I tried now with debug more for the rewrite on: |
Sorry for this being open so long without comment, but I thought I'd let you know that I just release a major update, and I also included an example of using the Bag Database behind a reverse proxy in the documentation: https://swri-robotics.github.io/bag-database/installation/docker/behind-a-reverse-proxy For what you're trying to do -- serve the Bag Database from a non-root path -- the easiest way to do that is to make the Tomcat server inside Bag DB's docker container also serve it from that path. There isn't a way to do that with the way the container is currently set up, but it would be very easy to build your own image that serves it from that path. If you edit the Dockerfile, you can change this line:
The name of the target war file determines the name of the path that is used to serve the application. |
Hello, podman run -d --name bagdb-frontend ... This still leads to the errors I posted before, but we see no obvious errors so far |
Hello,
in the readme it is mentioned that the bag-database can also be running behind e.g. haproxy.
In my case I would like to have it running behind an apache webserver for authentication and at a suburl like https://servername/bag
The issue I have is that the page tries to load the resources from https://servername/resources , not https://servername/resources/bag
Is there some value to change the base url? Or is there a change needed in the proxy?
currently my snippet looks like this
The text was updated successfully, but these errors were encountered: