{"record":{"id":"ee8c9d0c008639ba","repo":"BerriAI/litellm","slug":"rejected-polling-url-host-is-not-within-the-bfl-a","errorCode":null,"errorMessage":"Rejected polling URL: host is not within the bfl.ai domain","messagePattern":"Rejected polling URL: host is not within the bfl\\.ai domain","errorType":"exception","errorClass":"BlackForestLabsError","httpStatus":502,"severity":"error","filePath":"litellm/llms/black_forest_labs/common_utils.py","lineNumber":48,"sourceCode":"    from the submission host ``api.bfl.ai``. A strict same-origin check would\n    reject these legitimate URLs. Instead we verify the host is ``bfl.ai`` or\n    any subdomain of it, which keeps the SSRF guarantee (credentials only go\n    to BFL-controlled infrastructure) without false-positives on regional hosts.\n\n    Raises:\n        BlackForestLabsError: If the polling URL scheme or host is not trusted.\n    \"\"\"\n    parsed: Final = urlparse(polling_url)\n    host: Final = (parsed.hostname or \"\").lower()\n\n    if parsed.scheme != \"https\":\n        raise BlackForestLabsError(\n            status_code=502,\n            message=\"Rejected polling URL: scheme must be https\",\n        )\n\n    if host != _BFL_REGISTERED_DOMAIN and not host.endswith(\".\" + _BFL_REGISTERED_DOMAIN):\n        raise BlackForestLabsError(\n            status_code=502,\n            message=\"Rejected polling URL: host is not within the bfl.ai domain\",\n        )\n\n\n# Polling configuration\nDEFAULT_POLLING_INTERVAL: Final = 1.5  # seconds\nDEFAULT_MAX_POLLING_TIME: Final = 300  # 5 minutes\n\n# Model to endpoint mapping for image edit\nIMAGE_EDIT_MODELS: Final[dict[str, str]] = {\n    \"flux-kontext-pro\": \"/v1/flux-kontext-pro\",\n    \"flux-kontext-max\": \"/v1/flux-kontext-max\",\n    \"flux-pro-1.0-fill\": \"/v1/flux-pro-1.0-fill\",\n    \"flux-pro-1.0-expand\": \"/v1/flux-pro-1.0-expand\",\n}\n\n# Model to endpoint mapping for image generation","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/black_forest_labs/common_utils.py#L30-L66","documentation":"Error \"Rejected polling URL: host is not within the bfl.ai domain\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/black_forest_labs/common_utils.py:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a polling URL within the bfl.ai domain."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}