Skip to content
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

Redirect subdir with trailing slash. #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

phatpaul
Copy link
Collaborator

httpd-espfs.c :: tryOpenIndex() already tries to find and serve the content of index.html if the client requests a sub-directory.
This can result in the browser showing the content of /hello/index.html, but the browser's URL is http://blahblah/hello

If /hello/ is a directory, GET /hello should redirect to GET /hello/ to maintain relative paths for the browser.

We should automatically add a trailing slash so clients can properly resolve relative paths.
I.e. GET /hello should redirect to /hello/ because /hello/index.html might require ./app.js, which should resolve to /hello/app.js, NOT /app.js

The exception to this is the root directory does not require a trailing slash.
I.e. GET myapp.com can serve /index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants