comment http redirection, as this is handled by CF. Leave code as a reminder of the checkbox

This commit is contained in:
Emil Lerch 2020-04-23 17:03:31 -07:00
parent eeb2b590c3
commit d3f0eeb66b
Signed by: lobo
GPG Key ID: A7B62D657EF764F8

View File

@ -103,14 +103,15 @@ async function handleRequest(request) {
const requestPath = requestUrl.pathname; const requestPath = requestUrl.pathname;
let originUrl = `${originHost}${requestPath}`; let originUrl = `${originHost}${requestPath}`;
let home = null; let home = null;
if (requestUrl.protocol === 'http:') { // Cloudflare offers this as a checkbox
// The front-end has javascript to refresh the page after the whole // if (requestUrl.protocol === 'http:') {
// thing has been rendered, resulting in an ugly flash. We'll do the // // The front-end has javascript to refresh the page after the whole
// redirect server (well, edge) side instead. Note this breaks debugging, // // thing has been rendered, resulting in an ugly flash. We'll do the
// which we can fix later because deploys are so fast that we can // // redirect server (well, edge) side instead. Note this breaks debugging,
// just YOLO our changes // // which we can fix later because deploys are so fast that we can
return Response.redirect(request.url.replace(/^http/, 'https'), 301); // // just YOLO our changes
} // return Response.redirect(request.url.replace(/^http/, 'https'), 301);
// }
if (requestPath === '/' && request.method === 'GET') { if (requestPath === '/' && request.method === 'GET') {
originUrl = origin; originUrl = origin;
home = homePage(originHost); home = homePage(originHost);