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
Use relative paths in directory listing URLs #136
Comments
Sounds reasonable. |
Yep that works. At first I was thinking about the scenario where the user was hitting a directory URL without the trailing slash, but testing the non- Thanks! |
Alright! |
Why would it be breaking if |
In the context of relative paths discussed in the issue, what I meant is the following: So basically what we have to make sure of is:
|
But if you're accessing Edit: that is, the directory index links are always relative to the request URI, not |
Ahh, wait, indeed, I was missing something basic. The way I tested how browsers generate absolute URIs from relative paths with URIs ending in |
No, if you enter to |
I'm with you now. Thanks for the cluebatting. My previous tests were invalid and that lead me down the wrong path. (Sorry for the pun.)
But only the last component of the path should be used as the base in that case. That is, if the request is for |
Yes, that's correct.
That's why I remarked this above to take it into account for both cases. |
Yep, it all makes sense now. Thanks Jose! |
Released on v2.12.0 |
I run SWS behind an ingress controller in Kubernetes and typically use subpaths on the ingress, rewriting paths relative to / when proxying to SWS. This has been working perfectly, because of course serving static files is a relatively simple task. :)
I had a need to enable directory listings and noticed the URLs become invalid with this configuration due to the use of absolute paths relative to /
The simplest fix is to use relative URLs (
./filename
) in the directory listing HTML. The user's browser will take care of the rest, providing valid URLs that get cleanly rewritten by the upstream proxy.Then things should work properly regardless of whether SWS is behind a proxy subpath, and no additional user configuration is required. I don't see any downside?
The text was updated successfully, but these errors were encountered: