OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.37k stars 3.41k forks source link

Facing CORS header error while integrating dcm4chee with OHIF viewer #2226

Closed ptt-bs23 closed 1 year ago

ptt-bs23 commented 3 years ago

Hello! I am trying to integrate dcm4chee server in the OHIF viewer. I had success integrating this version of non secured dcm4chee which loaded my DICOM files properly.

But when I am trying to inegrate [this version of dcm4chee secured version] in the same way, I am having the following error.

Access to XMLHttpRequest at 'http://localhost:8080/dcm4chee-arc/aets/DCM4CHEE/rs/studies?limit=25&offset=0&fuzzymatching=false&includefield=00081030%2C00080060&StudyDate=19520727-20210106' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I am configuring it the same way like with the non secured dcm4chee version, where it worked.

default.js ( in the secured version where I am getting the error):

        wadoUriRoot: 'https://<my-local ip>:8443/dcm4chee-arc/aets/DCM4CHEE/wado',
        qidoRoot: 'https://<my-local ip>:8443/dcm4chee-arc/aets/DCM4CHEE/rs',
        wadoRoot: 'https://<my-local ip>:8443/dcm4chee-arc/aets/DCM4CHEE/rs',

In this version, I get dcm4chee when I hit https://:8443/dcm4chee-arc/ui2/

I am attaching a screenshot of the console: git1

Any help with this? I have tried to access with web browser extensions, but that didn't work either.

Thanks in advance.

ricardophp commented 3 years ago

same problem!!!! please, could you solve it?

olivert1969 commented 3 years ago

Hi @ptt-bs23 and @ricardophp, In your webserver configuration, suggest adding Access-Control-Allow-Origin configuration. For specific examples, see: https://docs.ohif.org/deployment/recipes/nginx--image-archive.html#cors-issues

reya276 commented 3 years ago

Hi @ptt-bs23 and @ricardophp, In your webserver configuration, suggest adding Access-Control-Allow-Origin configuration. For specific examples, see: https://docs.ohif.org/deployment/recipes/nginx--image-archive.html#cors-issues

Well I don't think those Access configs work, at least not in Apache2. Bellow is my config for the vhost in Apache2 because I get the same CORS error as the person above.

`<Directory /var/www/html/dist>

Header add Access-Control-Allow-Origin ":8042" Header add Access-Control-Allow-Origin "devdicom..com:8042" Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type" Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS" Header set Cache-Control "no-store"
    allow from all
    Options None
    Require all granted
</Directory>`

I've also tried using Header set Access-Control-Allow-Origin "*" and still no progress.

CORS Error MSG: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://devdicom..com:8042/dicom-web/studies?limit=25&offset=0&fuzzymatching=true&includefield=00081030%2C00080060. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)."

elamathis18 commented 2 years ago

hi @ptt-bs23, were you able to get the workaround for the cors issue ? I am trying to build OHIF from scratch only and have added the changes in app-config.js but still to no avail.

dem-v commented 2 years ago

I was able to workaround this issue only by installing combined docker image of nginx + ohif + othanc and providing config for nginx from https://enable-cors.org/server_nginx.html

sedghi commented 1 year ago

Could you please review our comprehensive documentation on Cross-Origin Resource Sharing (CORS) and OHIF? Below are the links provided for your reference.