Configure routerBaseName & PUBLIC_URL for an app hosted at non-root path

Describe Your Question

I’m embedding OHIF V3.7 inside a React app via an iframe.

I built the project, copied the build artifacts (contents of the dist folder), and
placed them inside the React app’s public folder under /ohif.

The React app is hosted at e.g. https://www.example.com/med/study-images/
routerBaseName is /med/study-images/ohif
and PUBLIC_URL is /med/study-images/ohif/

When I run the application, the iframe is empty.

In the network panel, I see the request to ohif/ succeed with a 200 but
I don’t see subsequent calls to app-config, bundles, and assets etc…

Any ideas why?

Does this work

<iframe
  src="/med/study-images/ohif/"
  width="100%"
  height="600px"
  title="Embedded Application"
/>

and then

public/
├── med/
│   └── study-images/
│       └── ohif/
│           ├── index.html
│           └── ...

You might need a <base> too

@alireza, yeah, I’ve tried that and the result is the same empty iframe.

If I change the iframe src to /med/study-images/ohif/index.html,
I see a black screen AND app-config.js plus the various css and js bundles get loaded.

But, I don’t see a call being made to /studies in the network panel.

This is my public folder structure:

public/
├── ohif/
│     ├── index.html
│     └── ...

I also see a bunch of messages in the console panel like

Registering old name UINotificationService
Registering old name DisplaySetService
New measurement mapping added to source 'Cornerstone3DTools@0.1'.
...

This tells me that the iframe is able to locate ohif, load the index.html file, and load the styles/scripts referenced in the <head> section.

Why doesn’t it load studies?

@alireza Any ideas why OHIF is not rendering? Here are some screenshots of the behavior: