Resources should not conflict
Closed this issue · 3 comments
Server A: index.html, available on /index with /stylesheet.css
Server B: registration.html, available on /registration with /stylesheet.css
Only the first CSS gets loaded, because the path would conflict one combined on the gateway. We should find a way around this (rewrite of the resource path?) and be able to serve both at the correct time.
I have mostly solved this, at least in a prototype way:
I pass a hydra-path header to the relevant URL. That way I know how to rewrite the URL on medusa's side. (The alternative was a rewrite of HTML on the gateway side, but that's surprisingly complicated since it's a stream of data instead of a string block)
So that means that when a url is loaded via the gateway, the header is added, thus the url is changed. For example, the url to the css becomes: /65413312/style.css
The call for this resource also goes through the gateway. Because it has a specific prefix, the correct route can be found. The correct route can then have its path rewritten with a built-in filter on the gateway. That way the correct url gets called on the correct endpoint.
TODOs:
- I need a list of resources to check first. I have this, but I don't think I have accounted for folders and such.
- I should also do this for websockets
Completed with 6cdde54