fix: recipe config cleanup, report-only CSP, logout redirect validation (#6124)

This commit is contained in:
Alireza authored and GitHub committed 2026-07-07 13:18:46 -04:00
1 parent 973631b7e8
commit f8546ce0e0
27 files changed
+446 -75

No files matched your search

@@ -54,6 +54,15 @@ http {
gzip_comp_level 9;
etag on;
# Content-Security-Policy: test in Report-Only mode first and watch
# the browser console for violations before switching the header name
# to the enforcing Content-Security-Policy. Note: nginx add_header does
# not merge into a location that sets its own add_header - if you
# promote this to an active header, re-declare it inside every location
# block that already uses add_header (several proxy locations here do)
# or it will silently not apply there.
# add_header Content-Security-Policy-Report-Only "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self' https: blob:; worker-src 'self' blob:; object-src 'self' blob:; frame-src 'self' blob:; frame-ancestors 'none'; base-uri 'self'; form-action 'self'" always;
location /sw.js {
add_header Cache-Control "no-cache";
proxy_cache_bypass $http_pragma;
@@ -101,19 +110,25 @@ http {
expires 0;
add_header Cache-Control private;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
# CORS: this recipe serves the viewer from this same nginx, so
# browser requests to this endpoint are same-origin and need NO
# CORS headers at all. If you host the viewer on a different
# origin, allow that origin explicitly and only that origin -
# never use '*' on an authenticated endpoint that serves PHI.
# Cross-origin example (response headers plus OPTIONS preflight):
# add_header 'Access-Control-Allow-Origin' 'https://viewer.example.com' always;
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
# add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
#
# if ($request_method = OPTIONS) {
# add_header 'Access-Control-Allow-Origin' 'https://viewer.example.com';
# add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
# add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
# add_header 'Access-Control-Max-Age' 1728000;
# add_header 'Content-Type' 'text/plain; charset=utf-8';
# add_header 'Content-Length' 0;
# return 204;
# }
rewrite ^/pacs/(.*) /dcm4chee-arc/aets/DCM4CHEE/rs/$1 break;
proxy_pass http://arc:8080;
@@ -155,19 +170,8 @@ http {
expires 0;
add_header Cache-Control private;
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept' always;
if ($request_method = OPTIONS) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Authorization, Origin, X-Requested-With, Content-Type, Accept';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
# CORS: same-origin deployment - no CORS headers needed here; see
# the note on the /pacs/ location above before adding any.
proxy_pass http://arc:8080;
}
@@ -4,7 +4,7 @@ email_domains=["*"]
cookie_secure="false"
cookie_expire="9m30s"
cookie_refresh="5m"
client_secret="2Xtlde7aozdkzzYHdIxQNfPDr0wNPTgg"
client_secret="REPLACE_WITH_A_GENERATED_CLIENT_SECRET"
client_id="ohif_viewer"
redirect_url="http://YOUR_DOMAIN/oauth2/callback"
@@ -686,7 +686,7 @@
"enabled": true,
"alwaysDisplayInConsole": false,
"clientAuthenticatorType": "client-secret",
"secret": "2Xtlde7aozdkzzYHdIxQNfPDr0wNPTgg",
"secret": "REPLACE_WITH_A_GENERATED_CLIENT_SECRET",
"redirectUris": [
"http://127.0.0.1/oauth2/callback"
],