2 months ago
Hey, I’ve deployed my app on Railway server. The deployment logs show that Caddy starts correctly, but I’m getting 404 Not Found errors for all routes when I visit the live site, including / and /login.
🔧 Setup:
• Deployment target: Railway
• Web server: Caddy
• Purpose: Serving frontend (Vite/React)
• Caddy logs:
{"level":"info","ts":…,"msg":"serving initial configuration"}
{"level":"info","ts":…,"msg":"serving HTTP on [::]:80"}
{"level":"info","ts":…,"logger":"http.log.access","msg":"handled request","request":{"method":"GET","uri":"/","proto":"HTTP/1.1"},"status":404}
…
🧩 What I’ve tried:
• Checked that the server is up and logs show no fatal errors
• Routes like / and /login all return 404
Thanks in advance! 🙏
0 Replies
2 months ago
i'm sorry but we don't offer urgent support for non-platform related issues, i will come back to this thread when i have some spare time or a community member may pop in to help you before that
I’m deploying a simple frontend (built with Vite) on Railway using the default Railpack (no custom Dockerfile). Everything seems to build and deploy correctly, but all routes (even /) are returning 404 in the logs:
2 months ago
can you share your caddyfile?
I have not explicitly defined the caddy configurations its just what logs files are showing so TL;DR I have no caddy file
2025-05-06T15:01:01.264519938Z [INFO] handled request bytesread=0 duration=0.000191314 logger="http.log.access.log0" request={"clientip":"49.43.161.118","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Accept-Language":["en-US,en;q=0.5"],"Priority":["u=0, i"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["cross-site"],"Sec-Fetch-User":["?1"],"Te":["trailers"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:138.0) Gecko/20100101 Firefox/138.0"],"X-Forwarded-For":["49.43.161.118"],"X-Forwarded-Host":["king-maker.up.railway.app"],"X-Forwarded-Proto":["https"],"X-Railway-Edge":["railway/asia-southeast1-eqsg3a"],"X-Railway-Request-Id":["DlaFFj97Sp2acMU3U2VV7A1774336823"],"X-Real-Ip":["49.43.161.118"],"X-Request-Start":["1746543658495"]},"host":"king-maker.up.railway.app","method":"GET","proto":"HTTP/1.1","remoteip":"100.64.0.4","remoteport":"43344","uri":"/"} respheaders={"Server":["Caddy"]} size=0 status=404 ts=1746543658.501624 user_id=""
These are the logs I am getting
2 months ago
just like to give you a friendly reminder that we do not offer urgent or any guarantee of a response within a specific time frame on the hobby plan, the conductors are volunteers, please be respectful of their time, and thank you for your patience.
Hey Brody, totally understood — I really appreciate the work you and the other conductors do here. I didn’t mean to sound demanding earlier, just got a bit stuck and stressed. Thanks for the reminder, and I’ll be more mindful going forward 🙏
2 months ago
my message was in response to the gif as it can be seen as impatience
2 months ago
@Vidhayak Ji is your vite building to the default dist folder?
2 months ago
^
2 months ago
This is the caddyfile it uses by default btw:
http://github.com/railwayapp/railpack/blob/main/core/providers/node/Caddyfile.template
2 months ago
You can overwrite it by creating your own Caddyfile
at root
this is caddyfile I am using now
global options
{
admin off
persistconfig off autohttps off
log {
format json
}
servers {
trusted_proxies static private_ranges 100.0.0.0/8
}
}
:{$PORT:80} {
log {
format json
}
respond /health 200
header {
X-Content-Type-Options "nosniff"
-Server
}
root * /usr/src/app/web/dist
file_server {
hide .git
hide .env*
}
encode {
gzip
zstd
}
try_files {path} {path}.html {path}/index.html /index.html
}
2 months ago
!s
Status changed to Solved medim • about 2 months ago