Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Hosting with a custom baseUrl does not work #4135

Open
peerfunk opened this issue May 16, 2024 · 4 comments
Open

[Bug] Hosting with a custom baseUrl does not work #4135

peerfunk opened this issue May 16, 2024 · 4 comments
Assignees

Comments

@peerfunk
Copy link

Describe the Bug

Custom URL - non root BaseUrl does not work. Files other then index.html can only found in the root path.
I tried a bunch of options, and checked if the past issue #2769 was resolved and it seems that in the code it is.
I do not seem to find the issue.

Steps to Reproduce

I based my tries on this guide: https://docs.ohif.org/deployment/custom-url-access/
First I tried building a Docker image, which is a bit different from this guide, you have to add the env to the dockerfile. it resulted in a container that will host all the files. The index will be available from the custom url, all other js files only from the root directory.
I then tried to build for production with pretty much the exact same commands as the guide, however I am on windows,so the guide is not accurate

The current behavior

hosting under a custom URL results in a blank page, the webbrowser is unable to load the js files

The expected behavior

I want to be able to host ohif under /ohif, the code should be writte in a way where a different baseUrl should not matter at all.

OS

Windows 10

Node version

18.18.2

Browser

Firefox 126.0

@peerfunk peerfunk added the Awaiting Reproduction Can we reproduce the reported bug? label May 16, 2024
@sedghi
Copy link
Member

sedghi commented May 16, 2024

Could you provide the steps you followed to reproduce the issue?

@insinfo
Copy link

insinfo commented May 16, 2024

Hosting with a custom baseUrl

I would also like to do this, it would be interesting if there was a docker image available that supports this

I didn't try to compile a version following the tutorial, as I'm not very familiar with node/react, I only work with Dart and AngularDart on a daily basis

@sedghi
Copy link
Member

sedghi commented May 16, 2024

@peerfunk
Copy link
Author

Could you provide the steps you followed to reproduce the issue?

For building a Docker image:

  1. edit platform\app\package.json add PUBLIC_URL=/ohif/ APP_CONFIG=config/default.js to build:viewer
  2. edit Dockerfile add ENV and ARG PUBLIC_URL /ohif/ APP_CONFIG config/default.js
  3. edit platform\app\config\default.js set routerBasename to /ohif
  4. edit serve.json, add route base, like in the tutorial
  5. docker build --no-cache . -t ohif_custom_root
  6. docker run ohif_custom_root -p 80:80
    This somehow does not work on my windows pc it only works on linux. On windows I get multiple errors while building in several tsx files ERROR in ../../../extensions/default/src/getCustomizationModule.tsx 3:0-83.
    I used docker build on this windows machine with an older version of the repo last August and it worked.
    I can however run the linux built image on the windows pc just fine (but with the incorrect root paths).

For running with npx:
Pretty much the sames steps, I just also set the windows env for PUBLIC_URL and APP_CONFIG before building similar to this:

$env:PUBLIC_URL="/ohif/"
$env:APP_CONFIG="config/ohif.js"
yarn build
npx serve -c ./public/serve.json //see tutorial on how to run it

I know that I set the variables twice, I just wanted to make sure not to miss something.

Hope this helps at least a little bit.
Thank you for your interest!

@sedghi sedghi removed the Awaiting Reproduction Can we reproduce the reported bug? label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants