S
SolidJS•4d ago
Josesito

SolidStart behind nginx reverse proxy

Hello kind peoples, I am having trouble running SolidStart behind an NGINX reverse proxy It "sort of works", I get the page to load with most content. but there's some buggy behavior, it does not seem to load javascript nor handle redirects, which work perfectly fine if I am just running in a docker container without the reverse proxy, for one of the pages the console just spits TypeError: Cannot read properties of null (reading 'nextSibling')..., not helpful at all.... for another page with a redirect, nothing happens. So SolidStart seems to load some assets, but does not get to the WebSocket request that would occur locally. So I assume there is some data getting lost because of the reverse proxy, but I am not sure
2 Replies
Josesito
JosesitoOP•4d ago
This is the network tab in the browser for a page that should simply redirect...but doesn't. As you can see, everything looks 200 but it isn't doing the redirect.
No description
Josesito
JosesitoOP•3d ago
That network request is suspicious, idk why it tries to load /_build/assets/_...404_-nXc_SCqO.js, which looks like a 404 error, on local it does not create this request, on local it loads the (index)-hash.js filename 🤔 smells like the routing might be failing across the reverse proxy.... I wonder if it is the clientside or the serverside router that fails Not sure how to further debug this 🤔 One sec... it might be something in my own logic because I am using a custom router It is not working whenever I port-forward between different ports, IDK what this means tho.... but app is running on port 3000 and I am port forwarding through port 80 or 8080, it breaks. If I port forward through port 3000 to 3000, such that the port by the browser is the same as exposed by the app.... then I don't get the issue. Strange! --- So I fixed this BTW turns out my env var was not getting read on the client when loading from the server, big mess, relevant conversation can be found here: https://discord.com/channels/722131463138705510/910635844119982080/1366288374704508998 tl;dr I am setting the base domain for my router in an env var at runtime, and that only works for the server, but not for the client, so I had to move this env var to the vite build-time vars

Did you find this page helpful?