Read OCR container doesn't work correctly when using "vision" in the hostname
When using the self-hosted OCR read docker container, you can't have the word "vision" in the host, as this will cause URL parsing to fail.
For example, when you give the container the hostname "azure-vision", doing a call on http://azure-vision:5000/vision/v3.2/read/analyze will result in the following "Operation-Location":
http://azure-vision/v3.2/read/analyzeResults/****ba7e
As you can see, it removed the port part (:5000), but it also removed the "vision" part from the URL. The correct Operation-Location should have been:
http://azure-vision:5000/vision/v3.2/read/analyzeResults/****ba7e
This happens basically with any "vision" in the host, for example:
http://visionazure:5000/vision/v3.2/read/analyze => http://vision/v3.2/read/analyzeResults/****64b7
We are using the docker image "mcr.microsoft.com/azure-cognitive-services/vision/read:3.2-model-2022-04-30".
-
Anshika Varshney 13,405 Reputation points • Microsoft External Staff • Moderator
Hi Jeroen,
Thank you for reaching out on the Microsoft Q&A.
The root cause of the issue you’re seeing with the Read OCR container is not a bug in the OCR logic itself, but how the container constructs and returns the Operation-Location URL when the hostname contains the substringvision.The Read container tries to build the callback URL from the incoming request’s host, but if the host name includes the string “vision”, the internal URL parser incorrectly strips out parts of the host and port, which breaks the returned URL. That’s why calling:
http://azure-vision:5000/vision/v3.2/read/analyzereturns an
Operation-Locationlike:http://azure-vision/v3.2/read/analyzeResults/……with both the port and the “vision” segment removed which leads to failed polling of results.
What’s happening:
The container expects to reconstruct the full callback URL.
When the host includes “vision”, the parser incorrectly drops parts of it.
- This affects any host like
azure-vision,visionxyz, or hostnames with.azure-vision.in them.
Please follow the below steps for fixing the issue:
Rename the hostname so that it does not include the substringvision. For example:Instead of
azure-vision:5000, useazureocr:5000Instead of
read-svc.azure-vision.svc.cluster.local, useread-svc.azureocr.svc.cluster.localOnce the host doesn’t contain the literal
visionstring, the container will return the correctOperation-Locationincluding the port and full path and the Read API calls will work as expected.I hope this has been helpful! Please let me know if there are any remaining questions or additional details, I can help with, I’ll be glad to provide further clarification or guidance.
Thankyou!
- This affects any host like
-
Anshika Varshney 13,405 Reputation points • Microsoft External Staff • Moderator
Hi Jeroen,
Thanks for your private comment. I truly apologize if the support provided did not fully meet your expectations.
We are currently checking the details and working on resolving the issue. We’ll update you as soon as we have more information.
Thankyou!
Sign in to comment
