Skip to content

armgit / pdfcn

Public Imported from GitHub
0

Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.

413 B
Raw Blame
export const requestOrigin = (request: Request): string => {
  const url = new URL(request.url);
  const forwardedHost = request.headers.get("x-forwarded-host");
  const forwardedProto = request.headers.get("x-forwarded-proto");

  if (forwardedHost) {
    const proto =
      forwardedProto ?? (url.protocol === "http:" ? "http" : "https");
    return `${proto}://${forwardedHost}`;
  }

  return url.origin;
};