{"record":{"id":"3c69aa2f5aff7358","repo":"paperclipai/paperclip","slug":"missing-host-header-if-you-want-to-allow-a-hostna","errorCode":null,"errorMessage":"Missing Host header. If you want to allow a hostname, run npx paperclipai allowed-hostname <host>.","messagePattern":"Missing Host header\\. If you want to allow a hostname, run npx paperclipai allowed-hostname <host>\\.","errorType":"http","errorClass":null,"httpStatus":403,"severity":"error","filePath":"server/src/middleware/private-hostname-guard.ts","lineNumber":77,"sourceCode":"  bindHost: string;\n}): RequestHandler {\n  if (!opts.enabled) {\n    return (_req, _res, next) => next();\n  }\n\n  const allowSet = resolvePrivateHostnameAllowSet({\n    allowedHostnames: opts.allowedHostnames,\n    bindHost: opts.bindHost,\n  });\n\n  return (req, res, next) => {\n    const hostname = extractHostname(req);\n    const wantsJson = req.path.startsWith(\"/api\") || req.accepts([\"json\", \"html\", \"text\"]) === \"json\";\n\n    if (!hostname) {\n      const error = \"Missing Host header. If you want to allow a hostname, run npx paperclipai allowed-hostname <host>.\";\n      if (wantsJson) {\n        res.status(403).json({ error });\n      } else {\n        res.status(403).type(\"text/plain\").send(error);\n      }\n      return;\n    }\n\n    if (isLoopbackHostname(hostname) || allowSet.has(hostname)) {\n      next();\n      return;\n    }\n\n    const error = BLOCKED_HOSTNAME_MESSAGE;\n    if (wantsJson) {\n      res.status(403).json({ error });\n    } else {\n      res.status(403).type(\"text/plain\").send(error);\n    }\n  };","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/middleware/private-hostname-guard.ts#L59-L95","documentation":"Error \"Missing Host header. If you want to allow a hostname, run npx paperclipai allowed-hostname <host>.\" thrown in paperclipai/paperclip.","triggerScenarios":"Thrown at server/src/middleware/private-hostname-guard.ts:77 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send requests with a Host header, or allow the hostname via npx paperclipai allowed-hostname <host>."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}