S
SolidJS10mo ago
MikeM42

SolidJS with Router behind Apache Proxy

I had initially written my app without a Router and it was working fine running behind an apache proxy, but I wanted some of the cool features of the Router so I added it, but none of the routing works behind the apache proxy. Everything works fine locally without proxy, but no longer behind the proxy. There's probably something I am either forgetting to configure in vite or in solid or in the apache proxy, but have no clue what it might be. Basically I defined some routes as so: export const Routes: Component = () => { return <Router> <Route path="/" component={SearchForm} /> <Route path="/urlselection" component={URLList} /> <Route path="/speech" component={Speech} /> </Router> } The app is simply define as follows: const App: Component = () => { return ( <SpeechContextProvider> <div class={styles.App}> <div class="container is-fluid"> <header class={styles.header}> <HeaderAndConfig/> </header> <Routes/> </div> </div> </SpeechContextProvider> ) }; The VITE config as follows (pretrty basic). Note that I had to set the base URL as empty otherwise I also get in trouble though I can also set it as an environment variable export default defineConfig(({ mode }) => { return { base: '', plugins: [ /* Uncomment the following line to enable solid-devtools. For more info see https://github.com/thetarnav/solid-devtools/tree/main/packages/extension#readme */ // devtools(), solidPlugin(), ], server: { port: 3000, }, build: { target: 'esnext', } } }) The apache proxy setup is as follows: ProxyRequests Off <Location /speechai/> ProxyPass http://localhost:8082/ </Location> When I go to https://server/speechai/ I get ALL the content defined in the App but not anything from the Router.
2 Replies
mdynnl
mdynnl10mo ago
you probably need to tell the router that the base url is /speechai somehow https://github.com/solidjs/solid-router/#router either from router side, both base and actionBase or better if you can pass the part after /speechai/ to node app as host probably with some regex + apache specific stuff
MikeM42
MikeM42OP10mo ago
Thank you, that did the trick. I wjust need to figure out the best way to do that mapping. Wonder if vite could help with that.
Want results from more Discord servers?
Add your server