Lissy93 / dashy

🚀 A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
https://dashy.to
MIT License
17.88k stars 1.36k forks source link

[FEATURE_REQUEST] Base path option #1036

Open Slyke opened 1 year ago

Slyke commented 1 year ago

Is your feature request related to a problem? If so, please describe.

No response

Describe the solution you'd like

BasePath or similar option for when behind a reverse proxy.

I can run it fine by directly accessing the IP address, eg: 123.123.123.123:4000, but if this is placed behind a reverse proxy with a subpath Dashy doesn't load at all.

The reason is due to absolute pathing when loading assets.

Lets say Dashy is hosted at mydomain.com/dashy, all requests will go to mydomain.com/. For example when requesting the manifest.json file, I can see it tries to request from mydomain.com/manifest.json instead of mydomain.com/dashy/manifest.json.

Adding in a BasePath or relative pathing config option, will allow for letting Dashy know that it should be requesting from a subdirectory.

I quickly checked the Config docs, but couldn't see anything relevant: https://github.com/Lissy93/dashy/blob/master/docs/configuring.md

I would imagine this would fall under the appConfig section.

Reopened since #923 was automatically closed.

Priority

Medium (Would be very useful)

Is this something you would be keen to implement

Yes!

dashy/configuring.md at master · Lissy93/dashy
🚀 A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more! - dashy/configuring.md at master · Lissy93/dashy
danieldietsch commented 1 year ago

There is the environment option BASE_URL, but for me, it does not work as expected.

I tried (as explained in multiple tickets around here and somewhat in https://github.com/Lissy93/dashy/blob/master/docs/management.md#passing-in-environmental-variables) the following.

For a) I can connect to dashy, but fail to load any assets because the initial response wants to load js and css from / and hence does not get proxied.
For b) (which would be the expected config) I receive Cannot GET /dashy from the node server.

So, I would very much welcome an implementation of that feature :)

dashy/management.md at master · Lissy93/dashy
🚀 A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more! - dashy/management.md at master · Lissy93/dashy
Usever commented 1 year ago

Same behavior here. Using docker compose with BASE_URL=/dashy. Browser returns error: "Cannot GET /dashy". Seems that BASE_URL env var is broken.

liss-bot commented 1 year ago

This issue has gone 6 weeks without an update. To keep the ticket open, please indicate that it is still relevant in a comment below. Otherwise it will be closed in 5 working days.

Slyke commented 1 year ago

Still an issue

zgurea1 commented 1 year ago

Still an issue

Slyke commented 1 year ago

Why is the liss-bot even turned on for feature requests? @Lissy93 so we don't have to come in every 6 weeks to have the label removed, lol.

KiwiActinidia commented 1 year ago

Still an issue also for me

DAMIOSKIDEV commented 1 year ago

Still an issue

ClenonWolf commented 1 year ago

Has this issue been fixed yet? Tried setting BASE_PATH=/dashy/ in docker but it didn't change any of the requests Dashy makes. It still requests http://server/js/ instead of http://server/dashy/js/.

nguyenleminhquan commented 10 months ago

Still an issue :<

ginoclement commented 7 months ago

Still an issue

rodalpho commented 6 months ago

I would find this very helpful too.

Docrom commented 6 months ago

Hello, is there any workaround for this issue yet ?

Sokwva commented 5 months ago

same issue.

hoggatt commented 2 months ago

There is an example in the documentation here that tells you to use BASE_URL=/dashy.

However, this does not work. When I load the latest version (3.1.1), I get this error in my browser console: https://example.com/conf.yml 404 (Not Found)

It should be pointing to https://example.com/dashy/conf.yml since this is where the assets should be. In fact, if I navigate to https://example.com/dashy/conf.yml, I can actually see my config! This seems like it should be a straightforward issue to fix, and I would consider it high priority since there is an example in your documentation.

I also see the same behavior for favicon.ico and loading-screen.css (not behind /dashy). Otherwise the page seems to load just fine.