{"record":{"id":"4fc6ea209b435c1a","repo":"sveltejs/kit","slug":"address-header-was-specified-with-env-prefix","errorCode":null,"errorMessage":"Address header was specified with ${env_prefix + 'ADDRESS_HEADER'}=${address_header} but is absent from request","messagePattern":"Address header was specified with (.+?)=(.+?) but is absent from request","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-node/src/handler.js","lineNumber":151,"sourceCode":"\ttry {\n\t\trequest = getRequest({\n\t\t\tbase: request_origin,\n\t\t\trequest: req,\n\t\t\tresponse: res,\n\t\t\tbodySizeLimit: body_size_limit\n\t\t});\n\t} catch {\n\t\tres.statusCode = 400;\n\t\tres.end('Bad Request');\n\t\treturn;\n\t}\n\n\tconst response = await server.respond(request, {\n\t\tplatform: { req },\n\t\tgetClientAddress: () => {\n\t\t\tif (address_header) {\n\t\t\t\tif (!(address_header in req.headers)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Address header was specified with ${\n\t\t\t\t\t\t\tenv_prefix + 'ADDRESS_HEADER'\n\t\t\t\t\t\t}=${address_header} but is absent from request`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst value = /** @type {string} */ (req.headers[address_header]) || '';\n\n\t\t\t\tif (address_header === 'x-forwarded-for') {\n\t\t\t\t\tconst addresses = value.split(',');\n\n\t\t\t\t\tif (xff_depth < 1) {\n\t\t\t\t\t\tthrow new Error(`${env_prefix + 'XFF_DEPTH'} must be a positive integer`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (xff_depth > addresses.length) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`${env_prefix + 'XFF_DEPTH'} is ${xff_depth}, but only found ${","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/adapter-node/src/handler.js#L133-L169","documentation":"When ADDRESS_HEADER is configured, adapter-node derives the client address from that request header inside getClientAddress instead of the socket. If the header is missing from the incoming request, this error is thrown because the server cannot determine the client address.","triggerScenarios":"A request reaches the SSR handler while env var ADDRESS_HEADER is set (e.g. 'x-client-ip') but the request lacks that header.","commonSituations":"Deploying behind a proxy that does not actually inject the configured header, or testing locally with curl where the header was never set.","solutions":["Ensure the reverse proxy always sets the configured ADDRESS_HEADER on every request","Change ADDRESS_HEADER to a header your proxy actually provides (e.g. x-forwarded-for)","Unset ADDRESS_HEADER to fall back to the socket address"],"exampleFix":"// before\nADDRESS_HEADER=x-real-ip  # proxy never sets it\n// after\nADDRESS_HEADER=x-forwarded-for","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await fetch(url);\n} catch (err) {\n  if (String(err.message).includes('but is absent from request')) {\n    console.error(`Proxy is not setting ${process.env.ADDRESS_HEADER}; fix proxy config or unset ADDRESS_HEADER`);\n  } else {\n    throw err;\n  }\n}","preventionTips":["Verify with `curl -H` that your proxy actually injects the configured header","Only set ADDRESS_HEADER to headers your proxy guarantees on every request","Use x-forwarded-for with XFF_DEPTH when behind a standard proxy","Do a smoke request through the full proxy chain before deploying"],"tags":["http","headers","proxy","adapter-node"],"backgroundTag":"missing-address-header","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}