R
Railway9mo ago
noahflk

Nixpacks Staticfile provider configure NGINX for SPA

My project is a React Vite app with React Router. Railway gets just static file, built by my GitLab CI. They get recognized as the Nixpacks Staticfile type when I deploy them on Railway. Now, how can I add an Nginx config that only adds SPA support. Meaning, all requests should be redirected to /index.html. This is the only configuration I want to do. Everything else should be handled automatically by Railway.
Solution:
Railway does not provide a way to provide an nginx.conf file for the staticfile provider. instead, have railway build your app and then serve it with caddy, example here https://github.com/brody192/vite-react-template take note of the nixpacks.toml and Caddyfile...
Jump to solution
3 Replies
Percy
Percy9mo ago
Project ID: 112010fe-dc1e-41d9-9c1b-cb0f97d35093
noahflk
noahflkOP9mo ago
112010fe-dc1e-41d9-9c1b-cb0f97d35093
Solution
Brody
Brody9mo ago
Railway does not provide a way to provide an nginx.conf file for the staticfile provider. instead, have railway build your app and then serve it with caddy, example here https://github.com/brody192/vite-react-template take note of the nixpacks.toml and Caddyfile
Want results from more Discord servers?
Add your server