nix-cache: redirect http to https
This commit is contained in:
parent
ea675c8818
commit
d91f1491f1
3 changed files with 25 additions and 12 deletions
|
|
@ -85,6 +85,12 @@ export default {
|
|||
return new Response(null, { headers: { allow: allowedMethods.join(', ') } });
|
||||
}
|
||||
|
||||
const url = new URL(request.url);
|
||||
if (url.protocol !== 'https:') {
|
||||
url.protocol = 'https:';
|
||||
return Response.redirect(url.toString(), 301);
|
||||
}
|
||||
|
||||
const authenticated = await authenticate(request, env);
|
||||
if (!authenticated) {
|
||||
return new Response('Unauthorized', {
|
||||
|
|
@ -93,7 +99,6 @@ export default {
|
|||
});
|
||||
}
|
||||
|
||||
const url = new URL(request.url);
|
||||
if (url.pathname === '/') {
|
||||
url.pathname = '/index.html';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue