How to redirect in railway config
Is there way to configure redirects in railway same way how netlify does?
netlify.toml
Solution:Jump to solution
https://github.com/brody192/vue-3-template
you shoud be able to copy the nixpacks.toml and Caddyfile from this repo into yours...
62 Replies
Project ID:
N/A
there is not, your app has to do the redirects itself
are you deploying a single page app?
yaah. I been having routing in client side. Hitting an issue where the default nginx config doesn't recognizes the client route and throws 404 when reloaded or visited externally to a specific route other than root of the site. Want to configure it to redirect to the
index.html
with the requested route insteadwhats your stack?
Got it to work on netlify. Just checking if railway can do it
vue with vue router
railway can, the app you deploy still has to handle the redirects
whats your bundler?
vite
do you have any build or start commands set in the service settings?
I just build locally and deploy. Having staticFile provider config on railway and root directory pointed to the locally built
dist
directoryso your dist folder is in your repo?
yep
couldn't really figure out how to both build and serve
remove it and then gitignore it
since after the build it is just static html
would you happen to have node_modules in your repo too?
i am not that stupid
dont worry ill get you sorted, trust the process
so no build or start commands in the service settings?
yaah
(yes/no)
?
yeah is kinda inclusive, im looking for a simple yes/no answer lol
bruh
YES
remove them
I have no build or start command in the service setting
has the dist folder been gitignored and removed from the repo?
yep removed
do you have a nixpacks.toml file?
no
does your package.json have a build script?
yes
Solution
https://github.com/brody192/vue-3-template
you shoud be able to copy the nixpacks.toml and Caddyfile from this repo into yours
hold on. lemmi
done
push the changes
error during build
am i missing something?
does vite not build to dist?
it does build to dist
build logs please https://bookmarklets.up.railway.app/log-downloader/
oh wait maybe the build is finished before caddy runs
you have a
Staticfile
right?yaah
yes*
delete it, you want this to be detected as a node app
its not letting me now
do you have a
Staticfile
in your repo?what are you reffering to ? Do i have Staticfile provider set in nixpack config?
literally a file called
Staticfile
lolno
use that instead
ah so it needs the
providers
array in the config for me to able to edit from UI
i didn't have any providers set in the nixpacks config beforeits a bug
Its still says StaticFile tho
did you push the changes to your repo with that new nixpacks.toml file?
yaah i did
did the build fail
the button to add new providers also appeared but got hidden after awhile. I didn't press anything
yes the build failed with the same error
Its not able to switch to node provider. Still set to
Staticfile
I have verified that the changes have been pushed as wellokay big bug, delete service and deploy a new service 🙂
Ah lemmi
It works!. Lets goo
Thanks brody for the help
no problem 🙂
Do i have to close the issue or does it close on its own?