API call CORS issue

Hi,

I’ll start to explain the current setup and the issue. If you need clarification please do not hesitate. Not sure too that this is the right place to talk about this issue, because it might not be Orthanc related.

I am trying to build a lab on AWS (disclaimer: I work for AWS as a solution architect) to have an Orthanc server, behind an elastic load balancer using Aurora Postgresql and S3.
The setup is working, I can connect to the load balancer DNS name and reach Orthanc, upload Dicoms and see them in the bucket.

Now I am trying to use this to label Dicom that are stored in Orthanc.
https://github.com/aws-samples/annotate-medical-images-in-dicom-server-and-build-ml-models-on-amazon-sagemaker

I do not use the stack to deploy Orthanc, I have it up and running, I use the one for Sagemaker and the labeling job.

In this stack I use the load balancer DNS name, that is used for an API call to get the dicom image and the manifest.json file I create should be ok, the source ID I use I have it from a curl command targeting the Orthanc server.

f I manually test the command it works:

curl -u orthanc:orthanc http://myelbdnsnamegoeshere/instances/32de62c1-381ac837-e843f0ae-770d263f-b925bb4c/file

I will pass some details on the labelling job, it uses Ground Truth from AWS, with a custom labelling page

https://github.com/aws-samples/annotate-medical-images-in-dicom-server-and-build-ml-models-on-amazon-sagemaker/blob/main/sagemaker-groundtruth/template.liquid.html

When I start the labelling job it gives me this error message:

Access to XMLHttpRequest at ‘http://myelbdnsname/instances/32de62c1-381ac837-e843f0ae-770d263f-b925bb4c/file’ from origin ‘https://s3.amazonaws.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

I am not able to make it work, I tried the following:

So there is this labelling job, using a custom page, trying to load the dicom image with an API call. It should talk to the load balancer that forward the request to the server, get the dicom image on S3 and return it to that webpage.

I am not sure where to look anymore, anyone has some ideas or suggestion ? logs to look ?

Could it be something else that a CORS issue ? Permission to access S3, encryption related ?

Thanks
Julien

Hello,

CORS-related questions heavily depends on your very specific infrastructure. In fact, Orthanc doesn’t provide any built-in support for CORS, so your issue is more than likely linked to your nginx configuration.

As you are working for AWS on a complex setup, I expect that you can find people in your team who could help you. You could also have a look at the freelancers who can provide dedicated support for B2B needs:
https://book.orthanc-server.com/users/support.html#finding-professional-assistance

Regards,
Sébastien-