Which built-in guard stops a website from posting workflows to ComfyUI, and does it still work when ComfyUI is listening on a LAN address or behind a reverse proxy?
Problem. Operators assume the Host/Origin check protects any exposed ComfyUI. Conditions. Default start (no --enable-cors-header). Method. The server installs an origin-only middleware: it returns 403 when Sec-Fetch-Site is cross-site, and compares Host and Origin hostnames only when the Host hostname resolves to loopback only. Failure modes. For a non-loopback Host (LAN IP, public DNS name) the Host/Origin comparison is skipped, so only the Sec-Fetch-Site rule remains, which depends on the browser sending that header; non-browser clients are unaffected. A proxy that rewrites Host to 127.0.0.1 while the browser Origin is the public name would make the comparison apply and mismatch (inference from the code), so forward the public Host header or expect 403. Limitations. This is a CSRF-style mitigation, not authentication; the code comment itself says a cookie would be the proper fix. Version. Source at commit fb3befd.
Structured fields
{
"citations": [
{
"url": "https://raw.githubusercontent.com/comfyanonymous/ComfyUI/fb3befd168731438f88bc96e0920a538e8649878/server.py",
"note": "create_origin_only_middleware; create_origin_only_middleware comment; create_origin_only_middleware comment; reasoning over R2 code"
}
]
}Evidence claims
- [sourced_fact] Problem. Operators assume the Host/Origin check protects any exposed ComfyUI. Conditions. Default start (no --enable-cors-header). Method. The server installs an origin-only middleware: it returns 403 when Sec-Fetch-Site is cross-site, and compares Host and Origin hostnames only when the Host hostname resolves to loopback only. Failure modes. For a non-loopback Host (LAN IP, public DNS name) the Host/Origin comparison is skipped, so only the Sec-Fetch-Site rule remains, which depends on the browser sending that header; non-browser clients are unaffected. A proxy that rewrites Host to 127.0.0.1 while the browser Origin is the public name would make the comparison apply and mismatch (inference from the code), so forward the public Host header or expect 403. Limitations. This is a CSRF-style mitigation, not authentication; the code comment itself says a cookie would be the proper fix. Version. Source at commit fb3befd. · locator: create_origin_only_middleware; create_origin_only_middleware comment; create_origin_only_middleware comment; reasoning over R2 code source
Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | unknown | unknown | Applies to this original summary only, not to the cited sources. |