conda-incubator / conda-store

Data science environments, for collaboration. ✨
https://conda.store
BSD 3-Clause "New" or "Revised" License
145 stars 50 forks source link

Valid sub-routes for the UI app result in 404 #899

Open gabalafou opened 2 weeks ago

gabalafou commented 2 weeks ago

Should we redirect all unknown routes to the React (UI) app?

When a user goes directly to a React app-defined sub-route (by sub-route I mean any route that is not the root route, "/"), such as "/:namespace/new-environment", the server will return a 404 instead of returning the conda-store-ui.html page.

We should probably redirect all unknown routes to the React (UI) app, conda-store-ui.

That way a user can copy-paste a link like "https://example.com/conda-store/default/new-environment" directly into their browser, as opposed to always having to start from "https://example.com/conda-store". Being able to load non-root routes was the whole point of introducing URL routing into the front end.

trallard commented 1 week ago

Does this mean that to get to let's say namespace/environments right now the user has to go through / then find their way through clicks to namespace/environments?

gabalafou commented 1 week ago

Yes that's exactly the issue

trallard commented 1 week ago

Pffff that sounds awful. So I would be in favour of finding a better way to deal with routes.

gabalafou commented 1 week ago

Exactly. The current configuration defeats the whole point of adding URL routing to the UI app. Part of the argument for getting rid of the tabbed interface was that a user could ctrl- or cmd-click on environments to open them in a new browser tab rather than a new Conda Store UI tab. But if we can't load the UI at URLs like /:namespace/:environment, then that ability to open environments directly in a new tab (or share them with others via URL) does not work.

I believe the usual solution here is to create catch-all or fallback route on the server that serves conda-store-ui.html. Right now, I believe the server is configured to serve that file at one and only one URL: "/" by default, or "/conda-store" in other configurations.

trallard commented 1 week ago

I assigned you @gabalafou and @peytondmurray - I would like you two to figure a solution to this.

peytondmurray commented 1 week ago

For my understanding, when a user pastes https://example.com/conda-store/foo/bar

Is that right?

gabalafou commented 1 week ago

Yes! Except it's not technically a redirect. It's not a 301. It's a 200 and you serve the conda-store-ui.html template at /foo/bar.

peytondmurray commented 1 week ago

Cool, thanks for the clarification - that solution sounds reasonable to me.

@gabalafou Feel free to pick this up as time permits.