Running orthanc+OHIF behing nginx - issue with authorization

Hi all,
I have a VPS running ubuntu with nginx as reverse proxy serving a wordpress website on the root location and orthanc on a separate location. I want to show studies using the ohif viewer plugin in an iframe on the wordpress website. I have figured out the CORS issues and everything is working well.
The issue that I have, is that I don’t want the user to be able to access anything on orthanc other than the studies (i.e. limited to the study level). But if I add HTTP authorization, that would be needed for the ohif viewer as well.
I have turned off authorization in orthanc.json and I’m trying to perform the authentication via nginx. I have been trying to bypass authoriztion for the /orthanc/ohif/viewer location using nginx, but it won’t work. I have tried these settings but have had no luck:

location ~* ^/orthanc/ohif/viewer {
auth_basic off; }

location ~* ^/orthanc/viewer(.)$ {
auth_basic off;
rewrite ^/orthanc/viewer(.
)$ /$1 break;
proxy_pass http://127.0.0.1:8042;
}

I thought I could alternatively perform the authorization using orthanc, and added something like this to my orthanc.js but it didn’t work either:

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,
      username: 'orthanc_username',
      password: 'orthanc_password',
    },
  ],
},

Any suggestions? :frowning: