MCPcopy Index your code
hub / github.com/code-forge-io/react-router-devtools / createDomain

Function createDomain

docs/app/utils/http.ts:7–23  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

5 * @returns Current domain
6 */
7export const createDomain = (request: Request) => {
8 const headers = request.headers
9 const maybeProto = headers.get("x-forwarded-proto")
10 const maybeHost = headers.get("host")
11 const url = new URL(request.url)
12 // If the request is behind a proxy, we need to use the x-forwarded-proto and host headers
13 // to get the correct domain
14 if (maybeProto) {
15 return `${maybeProto}://${maybeHost ?? url.host}`
16 }
17 // If we are in local development, return the localhost
18 if (url.hostname === "localhost") {
19 return `http://${url.host}`
20 }
21 // If we are in production, return the production domain
22 return `https://${url.host}`
23}

Callers 4

renderLlmsTxtFunction · 0.90
loaderFunction · 0.90
loaderFunction · 0.90
loaderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…