Vectrum
Sign In
8 lines · 333 Bytes · TypeScript
import "server-only";
import { headers } from "next/headers";

/** The address this request reached the server at, e.g. https://vectrum.cc. */
export async function serverOrigin() {
  const h = await headers();
  return `${h.get("x-forwarded-proto") ?? "http"}://${h.get("x-forwarded-host") ?? h.get("host") ?? "localhost:3000"}`;
}