Normalise case of Host header
Alan Pearce alan@alanpearce.eu
Sun, 07 Apr 2024 13:13:23 +0200
1 files changed, 1 insertions(+), 1 deletions(-)
jump to
M src/app.ts → src/app.ts
@@ -135,7 +135,7 @@ export const server = { fetch: async function (request) { const url = new URL(request.url); const pathname = url.pathname.replace(/\/\/+/g, "/"); - const hostname = request.headers.get("host") || "unknown"; + const hostname = request.headers.get("host")?.toLowerCase() || "unknown"; const endTimer = metrics.requestDuration.startTimer({ path: pathname }); let status; let newpath;