Flomp / wanderer

wanderer is a self-hosted trail database. Save your adventures!
GNU Affero General Public License v3.0
1.47k stars 38 forks source link

Possible to run behind reverse proxy under subpath? #26

Open danwinkler opened 8 months ago

danwinkler commented 8 months ago

Hi,

Thanks for making wanderer!

I'm running wanderer on a k8s cluster behind a reverse proxy (Ingress NGINX Controller). I'd like to host wanderer at <my-hostname>/wanderer. I tried setting the ORIGIN envvar to include the /wanderer subpath, but it seems the app always wants to fetch assets from /_app, which causes things to break. Is there a way to make this work?

Thank you!

Flomp commented 8 months ago

Currently this is not possible. It shouldn't be too difficult though. You would probably need to implement a simple routing middleware in sveltekit. That said, I currently won't put it super high on my priority list. I will add it to the roadmap though.

tofublock commented 3 weeks ago

I hope this belongs here, but it seems like it might be related: I'm running Wanderer behind a reverse proxy as https://wanderer.domain.tld (no subpath), and page reloads on any page other than the root page (so, e.g. on https://wanderer.domain.tld/trails) result in a 502 Bad Gateway from Nginx:

nginx.1 | 2024/11/09 10:12:24 [error] 53#53: *6 upstream sent too big header while reading response header from upstream, client: 192.168.0.1, server: wanderer.domain.tld, request: "GET /trails HTTP/2.0", upstream: "http://172.29.1.1:3000/trails", host: "wanderer.domain.tld" (Here's a Stackoverflow answer saying upstream sent too big header while reading response header from upstream is nginx's generic way of saying "I don't like what I'm seeing")

Since clicking the link on the page works just fine, I'm wondering if this might have something to do with routing in Svelte?

tofublock commented 3 weeks ago

And one more piece of information: direct page reloads of https://wanderer.domain.tld/settings work fine, all other sub-paths (/profile, /trails, /map, /lists) don't.

Flomp commented 3 weeks ago

That's strange because the demo instance is running behind a nginx reverse proxy without any issues. Could you provide your nginx config?

tofublock commented 3 weeks ago

Apologies, this is unrelated to the original topic. First thing I did when I found the problem was trying to increase proxy buffer sizes and that didn't change anything. I tried again just now, and the problem went away. Here's the new sizes, for anybody coming after me:

proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;

Sorry again. Awesome work with the project!

gri38 commented 2 weeks ago

Hello. Same need here: I would like a parameter to set a subpath to the frontend, so it can request: https://mydomain.com/sub/path/wanderer/xxx, instead of https://mydomain.com/xxx

My nginx rewrites this url to: http://docker-wandrer-web-service-name:3000.

BTW: thanks a lot for that awesome project !! You contribute to provide a clean web, not depending on the ad. That's very valuable, thanks.