Hi Everyone,
I have integrated OHIF Viewer with Meteor and here we used to upload Dicom i.e .dcm images to Orthanc Server. This is the basis procedure for this
- We upload a dicom file
- Orthanc Server is providing some REST APIs to store the images and it returns the generated URL.
- We store the returned URL in our DB for future use.
Now the Problem, We are using digital Ocean for hosting and both Orthanc server and our meteor Project is hosted on the same server. Both of them, running on different ports.
So, while displaying the stored image in Orthanc Server, I am getting CORS Error as
Failed to load http://siteName:8080/instances/af49dc5b-f0251/d27-ebbf0c68-3080fd96-e13e32c2/preview: No âAccess-Control-Allow-Originâ header is present on the requested resource. Origin âhttp://sitenameâ is therefore not allowed access.
Also, I have made changes in the sites-enable sitename.conf file as
server{
listen [::]:80;
server_name sitename
location /orthanc/ {
proxy_pass http://localhost:8080;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
rewrite /orthanc(.*) $1 break;
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,K$
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Origin' '*';
}
}
The same is mentioned in the HOW CAN I RUN ORTHANC behind NGINX
Also, I have added this in main.js of server,
**WebApp.rawConnectHandlers.use(function(req, res, next) { res.setHeader("Access-Control-Allow-Origin", "*"); return next(); });**
but this also is not helping
Is there any solution for this CORS issue. Any help would be great