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

Add support for --server-prefix for catalog-create to deploy catalog not in the root of the website #443

Open
yarikoptic opened this issue Apr 22, 2024 · 5 comments
Labels

Comments

@yarikoptic
Copy link
Member

After migration to https://router.vuejs.org/guide/essentials/history-mode.html some changes required to have /assets and /artwork to be placed at / since while navigating into "/sub/folders" in the new mode it would also append those if they were relative. For datalad-registry we need to deploy catalog under some /catalog/ prefix or alike, so then we cannot serve them from the /.

@jsheunis
Copy link
Member

jsheunis commented Apr 23, 2024

@yarikoptic I was thinking about this again, was there a specific reason why having relative URLs wouldn't be sufficient and why something like a base url would be specifically necessary?

I've started working on this locally and made all URLs relative, and ended up with the same error that we stopped at previously. So there seems to be an issue with all-relative URLs, but I still need to figure out what exactly.

@yarikoptic
Copy link
Member Author

I think it was the fact that whenever you go to some /prefix/something/redirected/to/indexabove.html then any relative links (e.g. to assets/blah) within /prefix/index.html become relative to the path of that page i.e. /prefix/something/redirected/to/assets/blah. That is why we wanted them absolute to be /prefix/assets/blah.

@jsheunis
Copy link
Member

Ok so redirection is the cause.

@jsheunis
Copy link
Member

The use of the <base> html tag in the index page meta seems to be useful. If I make all URLs relative and include <base href="/"> inside the page metadata, the page renders correctly, and navigation also works correctly. This is when the app is served from root, e.g. http://localost:8000.

If I change the root so that the app is served from e.g. http://localost:8000/datalad_catalog/catalog, and also change the base tag to <base href="/datalad_catalog/catalog/">, then the page also renders correctly. But when I then navigate to a specific dataset url, e.g. http://localhost:8000/dataset/deabeb9b-7a37-4062-a1e0-8fcef7909609/6d7fb68264f9b9951ae141fc830712a8744e3293, I get a standard 404 (not the app-specific 404 page). I think the required redirection setup that takes care of the VueJS single-page-app history mode shortcoming is to blame for this, since I didn't update that redirection url to account for the changed base url. I must still test this though. A challenge that I see here and that I'm not sure how to fix would be that the server redirection setup is not (necessarily?) dynamic, so how would one specify a dynamic base url/prefix to a static server setup...

@yarikoptic
Copy link
Member Author

http://localhost:8000/dataset/deabeb9b-7a37-4062-a1e0-8fcef7909609/6d7fb68264f9b9951ae141fc830712a8744e3293, I get a standard 404 (not the app-specific 404 page)

why it is not http://localost:8000/datalad_catalog/dataset/... ?

so adding that /datalad_catalog/ prefix explicitly to those locations to reach /assets/ and /artwork/ isn't enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants