{"record":{"id":"a20ae2cabb618889","repo":"BerriAI/litellm","slug":"azure-document-intelligence-rejected-polling-url","errorCode":null,"errorMessage":"Azure Document Intelligence: rejected polling URL ({ssrf_err})","messagePattern":"Azure Document Intelligence: rejected polling URL \\((.+?)\\)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/ocr/document_intelligence/transformation.py","lineNumber":592,"sourceCode":"            if status == \"succeeded\":\n                return response\n            elif status == \"running\":\n                # Wait before polling again\n                retry_after = self._get_retry_after(response=response)\n                await asyncio.sleep(retry_after)\n\n    def _get_polling_target(self, raw_response: httpx.Response) -> tuple[str, dict[str, str]]:\n        operation_url: Final = raw_response.headers.get(\"Operation-Location\")\n        if not operation_url:\n            raise ValueError(\"Azure Document Intelligence returned 202 but no Operation-Location header found\")\n\n        # Reject cross-origin polling URLs — the auth headers\n        # below would otherwise leak to whatever URL the upstream\n        # (or an attacker-controlled upstream) returns. VERIA-51.\n        try:\n            assert_same_origin(operation_url, str(raw_response.request.url))\n        except SSRFError as ssrf_err:\n            raise ValueError(f\"Azure Document Intelligence: rejected polling URL ({ssrf_err})\")\n\n        poll_headers = {\"Ocp-Apim-Subscription-Key\": raw_response.request.headers.get(\"Ocp-Apim-Subscription-Key\", \"\")}\n        return operation_url, poll_headers\n\n    def _transform_completed_response(self, model: str, raw_response: httpx.Response) -> OCRResponse:\n        \"\"\"\n        Transform a completed Azure Document Intelligence analyze operation\n        into the Mistral OCR response shape, preserving Azure-native\n        `analyzeResult` fields (`content`, `tables`, `keyValuePairs`) as\n        top-level response fields.\n        \"\"\"\n        operation: Final = AzureDocumentIntelligenceOperation.model_validate(raw_response.json())\n\n        verbose_logger.debug(\"Azure Document Intelligence response status: %s\", operation.status)\n\n        if operation.status != \"succeeded\":\n            raise ValueError(f\"Azure Document Intelligence analysis failed with status: {operation.status}\")\n","sourceCodeStart":574,"sourceCodeEnd":610,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/azure_ai/ocr/document_intelligence/transformation.py#L574-L610","documentation":"Error \"Azure Document Intelligence: rejected polling URL ({ssrf_err})\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure_ai/ocr/document_intelligence/transformation.py:592 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The polling URL failed SSRF validation; ensure the endpoint is your trusted Azure resource and not a redirect."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}