mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 17:08:27 +00:00
11 lines
291 B
TypeScript
11 lines
291 B
TypeScript
// Updates the protocol of the request url to match the request.headers x-forwarded-proto
|
|
export function requestUrl(request: Request): URL {
|
|
const url = new URL(request.url);
|
|
|
|
if (request.headers.get("x-forwarded-proto") === "https") {
|
|
url.protocol = "https:";
|
|
}
|
|
|
|
return url;
|
|
}
|