Improve some problematic redirects.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3666 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2021-10-04 01:15:33 +00:00
parent d3e02470cd
commit 24a91219c1

View File

@ -412,7 +412,7 @@ async function blobHandler(request, response, blobId, uri) {
}
if (!uri) {
response.writeHead(301, {"Location": "/" + blobId + "/"});
response.writeHead(303, {"Location": 'http://' + request.headers.host + blobId + '/', "Content-Length": "0"});
response.end(data);
return;
}
@ -489,7 +489,7 @@ httpd.all("/login", auth.handler);
httpd.all("", function(request, response) {
var match;
if (request.uri === "/" || request.uri === "") {
response.writeHead(303, {"Location": gGlobalSettings.index, "Content-Length": "0"});
response.writeHead(303, {"Location": 'http://' + request.headers.host + gGlobalSettings.index, "Content-Length": "0"});
return response.end();
} else if (match = /^(\/~[^\/]+\/[^\/]+)(\/?.*)$/.exec(request.uri)) {
return blobHandler(request, response, match[1], match[2]);