solid-router icon indicating copy to clipboard operation
solid-router copied to clipboard

Router: domain-based routing

Open indeyets opened this issue 3 years ago • 4 comments

It would be great to have support for domain-based routing. I need to be able to server different pages on different domains.

Could it be configured via additional sub-component of <Routes> maybe?

<Routes>
  <DomainRoutes domain=":language.example.com">
    <Route path="/some-page" component={LocalizedPage} />
  </DomainRoutes>

  <Route path="/some-page" component={DefaultPage} />
</Routes>

indeyets avatar Dec 04 '22 22:12 indeyets

Or should this issue be moved to @solidjs/router instead?

indeyets avatar Dec 05 '22 11:12 indeyets

Yeah I think that it should be moved to the router

orenelbaum avatar Dec 05 '22 20:12 orenelbaum

So I understand you have the same site more or less on different domains, and you would like certain routes to only appear on those Domains. The route definition is just JSON ultimately even though we use components, so it could be conditionally constructed I imagine. Unless I'm misunderstanding the use case.

I guess on the server you want to use the request to determine if the routes should be registered and in the client the current URL in the browser?

ryansolid avatar Aug 08 '23 20:08 ryansolid

Domains might have quite different sets of urls, actually. One case is "search." subdomain which would handle a separate set of "pages"

I talk about generic ability to match over domains in addition to the current ability of matching over paths

indeyets avatar Aug 08 '23 21:08 indeyets