Skip to content
Snippets Groups Projects
Commit 187f8f8a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Respond with redir when directory requests are received without trailing slash

HTTP Directory requests without a trailing slash would "work" (the directory
listing would be sent), but the links to files, since they're relative to the
current request location, would be incorrect (missing the directory's virtual
subdir). So send a 301 response if a client requets a directory without a
trailing slash.
parent cbee35b6
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -114,6 +114,11 @@ function root_index()
}
if(http_request.dir !== undefined) {
if(http_request.virtual_path[http_request.virtual_path.length - 1] != '/') {
http_reply.status = "301 Moved";
http_reply.header.Location = http_request.virtual_path + '/';
exit();
}
dir_index(http_request.dir);
} else if (http_request.lib !== undefined) {
lib_index(http_request.lib);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment