-
Notifications
You must be signed in to change notification settings - Fork 111
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
Folders are not redirected if missing a slash at the end #130
Comments
I support either resolving this issue with the expected behavior or an evaluation of the expected behavior. I spent more time than I want to admit on a wild goose change, because I did not notice the missing slash in my URLs. But, I propose an alternate expected behavior. Expected behavior If the requested URL points to a folder with an Either, help the user out completely (my interpretation of the suggestion of the original poster); or, do not halfway help the user, thus leading to unexpected behavior. |
Hi, do you plan to implement the expected behaviour? If not, I'll need to implement a workaround requiring me hitting the disk for every incoming request to test whether the requested resource is a directory or not. This is obviously sub-optimal since downstream, koa-send will again stat the filesystem for each request. |
i thought this was an option... |
I think this solved by this PR. |
Expected behavior
If the requested URL points to a folder with an
index.html
file and it is missing a slash at the end, the server should respond with a redirect with a slash added at the end.Actual behavior
If the requested URL points to a folder with an
index.html
file and it is missing a slash at the end, the server does not redirect with the slash added, making the browser think that the folder name is a file name, which in turn makes relative URLs work differently depending on whether or not the slash is present.How to reproduce
npm install
andnpm start
http://localhost:3000/folder
. Observe that no redirect took place. The image of a black square is displayed, even thoughimage.png
is in the parent directory offolder/index.html
.http://localhost:3000/folder/
. Observe that the image is (correctly) not displayed.The text was updated successfully, but these errors were encountered: