-
Notifications
You must be signed in to change notification settings - Fork 82
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
proxy to URI other than web root #149
Comments
Hello! Apache configuration isn't something I'm very knowledgeable about so I don't have a great answer to give :( |
And here are the logs from running polaris with the -f switch. The GETs from 127.0.0.1 are the proxied "session": 14:49:08 [INFO] [/home/z/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-3.3.2/src/middleware/logger.rs:337] 127.0.0.1:34028 "GET /api/initial_setup HTTP/1.1" 200 22 "http://zeus.z.net/" "Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 0.000802 And these should be me browsing directly to the rust server (port 5050). Note that there were a couple of browsing events that occurred, so the following logs are a bit longer that the preceding logs: 14:54:05 [INFO] [/home/z/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-web-3.3.2/src/middleware/logger.rs:337] 192.168.0.47:50074 "GET / HTTP/1.1" 200 446 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0" 0.000630 |
The failed requests don't even show up in the log so it's possible they weren't routed to the Polaris server at all. When you get a failed request in your Chrome debug tool, can you look at the content of the I think the issue is either:
|
Hi Antoine, Some progress... Looks like apache (by default) returns 404 for any URIs with encoded slashes: http://httpd.apache.org/docs/2.4/mod/core.html#allowencodedslashes Thus, this configuration works for reverse proxying polaris at the web root: <VirtualHost *:80> That being said, I'm still hitting issues with a reverse proxy setup at /polaris. You can see the 200 for /polaris/, but then 404s after that: 192.168.0.47 - - [04/Oct/2021:11:59:32 -0500] "GET /polaris/ HTTP/1.1" 200 675 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36" I'll keep digging on this end. |
Hello, I believe I have it solved... I thought I had this apache module enabled, but I didn't: https://httpd.apache.org/docs/2.4/mod/mod_proxy_html.html So, after the following: a2enmod proxy_htmlThe following config works: <VirtualHost *:80> |
I'm still fighting trying to get /polaris/ to be a gateway for http://127.0.0.1:5050/ I'm still researching and seeking to get this working, but I thought I'd update the ticket with my current status of "not quite there". So, if anyone has advice to offer, I'd love to hear it. |
I spoke with folks on the apache users mailing list and the following apache configs are allowing me to reverse proxy polaris at example.com/polaris `<VirtualHost *:80>
` Until things don't work, I'd say the above is my working configuration. |
Thank you for reporting back. I'm happy you got it working! 🎉 |
Greetings,
Thank you for writing Polaris. I'm new to the project, but looking forward to being more experienced with it.
I've tried setting up polaris to run behind an apache gateway (reverse proxy) and have used #118 as a template for the apache configuration.
There are 3 different tests I am performing...
[a] browsing directly to the rust web server (port 5050)
[b] putting polaris behind a reverse proxy at the web root (/)
[c] putting polaris behind a reverse proxy at the location /polaris/
[a] works as expected (I'm excited!), but I'm getting less than perfect results with [b] and [c].
Polaris seems to be more happy with configuration that support [b] than [c]. But, I have got [c] to work with some hackery.
For instance, the following apache configuration appears to work out of the box:
Location: http://www.example.net/#/welcome
[0]
<VirtualHost *:80>
ProxyPass / http://127.0.0.1:5050/
ProxyPassReverse / http://127.0.0.1:5050/
but things do not work as expected when I change the proxy configurations to:
[1]
<VirtualHost *:80>
ProxyPass /polaris/ http://127.0.0.1:5050/
ProxyPassReverse /polaris/ http://127.0.0.1:5050/
for instance, the JS seems to be stuck unless I start apache in configuration [0] and then change to [1] and restart. That is if I modify [1] and restart apache, then I only get a blank screen when browsing to:
Location: http://www.example.net/polaris/#/welcome
So.. I set the configs to [0], then change it to [1] and I get the welcome page, but after entering the music location information and configuring a basic user there are other things that don't work quite right. For instance the directory images don't show up. When drilling down into a directory the left pane does not refresh. Here is a screenshot showing things:
Neither [b] nor [c] (with corresponding apache configs [0] and [1]) play music or correctly display directory contents in polaris.
This might be able to be solved with some apache mod_rewrite magic or proxy configuration, but I thought I'd bring the issue up here to see what you thought.
Thank you for your help!
The text was updated successfully, but these errors were encountered: