LucHeart / HA-Ingress-Reverse-Proxy

MIT License
0 stars 0 forks source link

Problem using absolute urls #1

Open hcooper opened 2 years ago

hcooper commented 2 years ago

Hey, I've been building something very similar to this myself (and found yours when searching for X-Ingress-Path). The main issue I've found is when the backend service uses absolute URLs for assets, rather than relative ones.

For example the backend can tell the browser to fetch "script.js" with a relative path, or an absolute path:

"script.js" is successfully fetched as.... https://myhomeassistant.com/api/hassio_ingress/CCv8u55X6LySeReUebnyPuJhYmi1Y4/script.js

"/script.js" is unsuccessfully fetched as... https://myhomeassistant.com/script.js

I'm struggling to think of a way to handle this without making changes to the backend service itself.

Any ideas?

LucHeart commented 2 years ago

Nope, cant really do anything about it I think. I tried to build myself a nice little dashboard to access all of my other services in my home network.

You would need someway of telling the site you are loading trough the ingress reverse proxy to translate all urls, but because of security reasons, im pretty sure that would be impossible, unless there is proper method implemented in a browser.

LucHeart commented 2 years ago

Also, tbf, I havent looked at this for quiet some while now, but absolute urls seem to work fine with frigate, interesting enough.

LucHeart commented 2 years ago

I pretty sure there is some sort of translation js inbetween every request, not sure how it would work or if thats the case, seems a bit like magic.

I ran into my initial issue again. As I said, I wanted to have multiple service web interfaces managed trough one site, I tried to add different endpoints on different nginx locations, but that doesnt work as the absolute urls of the webinterface im trying to load would override my initial "prefix" i would be using as location.