From 24a91219c17c351f536d35a3ae43effd44428f78 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 4 Oct 2021 01:15:33 +0000 Subject: [PATCH] Improve some problematic redirects. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3666 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/core.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/core.js b/core/core.js index 9db74919..4ff0599d 100644 --- a/core/core.js +++ b/core/core.js @@ -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]);