IFRCGo/go-user-library

Get assets to work when running at domain root

Closed this issue · 5 comments

We are moving the Github Pages hosting for this repository from https://ifrcgo.org/go-user-library to https://go-user-library.ifrc.org

It seems like currently assets are expecting to be served with a /go-user-library/ prefix and fetching all static files breaks when running at the domain root instead of at a /go-user-library path.

Ideally, the paths to static assets would be relative so it would work either when running at the domain root or inside a folder. If that is hard to get working, we should just assume this is hosted at a domain root and not inside a folder.

I can look through the config, though not sure if someone more familiar knows immediately where we'd need to make this change.

cc @tovari

hi @JulioPeral, would you be able to help here? Thanks!

Hello @batpad Where is the new hosting? probaly you will ned to change the path on the package.json from
"homepage": "/go-user-library" to "homepage": "/"
You will need to build the site again. Give it a try and let me know if that worked.

Thanks @JulioPeral let me try this!

We are going to continue hosting on Github w/ Github pages as the current setup, just changing the domain that's pointing to the github pages - so current process to deploy, etc. will all remain he same, this is just changing the DNS (but that also resulted in a path change causing the above error ) - thanks for the note!

I have tried this locally and setting the homepage path in package.json seems to all work and do the right thing.

So, next steps would be:

  • Change the Github Static Pages config to again serve for the hostname go-user-library.ifrc.org
  • Do a build + deploy with the homepage parameter in package.json set to /

This should make everything work when served from go-user-library.ifrc.org - of course, changing the domain will mean that the current https://ifrcgo.org/go-user-library URL will no longer work. (If we wanted that to work, there'd be some additional work to setup a redirect).

@tovari we should be able to coordinate this whenever we want to try the domain move again - it would just be changing Github settings and me making a deploy after changing the homepage setting.

Thanks again for the pointer @JulioPeral .

It's still appearing, after the moving to *ifrc.org:
kép
Also: strict-origin-when-cross-origin | Is it relevant?