Hello everyone,
I recently migrated my Orthanc setup from an Ubuntu server to a new RHEL9 server, and I’m encountering issues with the OHIF plugin. Here’s a breakdown of my setup and the problem:
- I’ve deployed Orthanc in a Docker container, and it’s functioning properly.
- When I open a study in OHIF, I only see a blank black screen with the OHIF favicon. The study does not load.
- Checking the browser console, I see the following errors:
When I access the manifest.json
file directly, the file looks like this:
{
"name": "OHIF Viewer",
"short_name": "Viewer",
"description": "OHIF Viewer",
"dir": "auto",
"lang": "en-US",
"orientation": "any",
"icons": [
{
"src": "/assets/android-chrome-36x36.png",
"sizes": "36x36",
"type": "image/png"
},
{
"src": "/assets/android-chrome-48x48.png",
"sizes": "48x48",
"type": "image/png"
},
{
"src": "/assets/android-chrome-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "/assets/android-chrome-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "/assets/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/assets/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/assets/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "/assets/android-chrome-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "/assets/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "./index.html",
"background_color": "#000000",
"display": "standalone",
"theme_color": "#20a5d6"
}
Previously, I had a similar issue when setting up OHIF on my old Ubuntu server. It showed a black page, but I don’t recall if the errors in the console were the same. Eventually, I figured the issue was CORS-related and fixed it. I suspect the issue is related to CORS, but I’m not entirely sure.
Current Server Setup
- Web server: Nginx, RHEL 9, Orthanc: orthancteam/orthanc Docker (mainline), OHIF plugin (mainline). The server has a valid SSL CA certificate.
- CORS Headers: I’m using the same CORS headers from OHIF and Orthanc documentation & forums. Please see below for the nginx config.
Here’s my OHIF-related config in Orthanc:
"OHIF" : {
"RouterBasename": "/ohif/",
"UserConfiguration" : "/etc/orthanc/ohif.js"
},
And my ohif.js is:
window.config = {
useSharedArrayBuffer: false,
extensions: [],
modes: [],
whiteLabeling: {
createStyleComponentFn: function (React) {
return React.createElement('style', {}, `
flex {
display: none!important;
}
`);
},
},
Orthanc: {
Servers: [
{
name: 'Orthanc',
wadoUriRoot: '/orthanc/wado',
qidoRoot: '/orthanc/dicom-web',
wadoRoot: '/orthanc/dicom-web',
qidoSupportsIncludeField: true,
supportsReject: true,
imageRendering: 'wadors',
thumbnailRendering: 'wadors',
enableStudyLazyLoad: true,
},
],
},
cornerstoneExtensionConfig: {
disableEditing: true,
},
ui: {
showMeasurementTable: false,
measurementTable: {
showRelabel: false,
showDelete: false,
},
},
};
Here’s my orthanc.conf
file for Nginx:
server {
listen 443 ssl http2;
server_name casebank.swmed.edu;
ssl_certificate /etc/nginx/ssl/ssl.pem;
ssl_certificate_key /etc/nginx/ssl/ssl.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
set $cors '';
if ($http_origin ~ '^https?://(localhost|www\.swmed\.edu|casebank\.swmed\.edu)') {
set $cors 'true';
}
location / {
if ($cors = 'true') {
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
add_header 'Cross-Origin-Opener-Policy' "$http_origin";
add_header Cross-Origin-Embedder-Policy require-corp;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
proxy_pass http://127.0.0.1:8042/;
rewrite /orthanc(.*) $1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
What I Tried
- Disabling
sharedArrayBuffer
in bothohif.js
andorthanc.json
(one at a time).
- Doing this results in a 502 error instead of the black screen.
- These CORS headers:
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' 'https://casebank.swmed.edu' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
add_header Cross-Origin-Embedder-Policy require-corp;
add_header Cross-Origin-Opener-Policy same-origin;
proxy_pass http://127.0.0.1:8042/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
add_header 'Access-Control-Allow-Origin' 'https://casebank.swmed.edu' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
I would greatly appreciate any guidance or suggestions to troubleshoot and resolve this issue.
Cheers!