Cannot GET / - HTTP Error 404

Hey, I have installed Ghost using Docker. The Ghost instance is deployed on Railway and is reverse proxied through Caddy. I am using the latest version of Ghost. The traffic flow is as follows:

Cloudflare → Railway → Caddy → Ghost

My problem is that I get a Cannot GET, 404 error.

Here is my Caddy configuration snippet:

:80 {

handle_path /blog* {

reverse_proxy {env.BLOG_URL} {

header_up X-Forwarded-For {remote_host}

header_up X-Forwarded-Proto https

header_up X-Real-IP {remote_host}

header_up Host {host}

}

}

}

Caddy handles traffic through https://mydomain.app/blog. This works well since I have other handle_path configurations here.

And here is my Ghost .env configuration (configured via Railway):

database__client=“mysql”

database__connection__database=“${{MySQL.MYSQL_DATABASE}}”

database__connection__host=“${{MySQL.RAILWAY_PRIVATE_DOMAIN}}”

database__connection__password=“${{MySQL.MYSQLPASSWORD}}”

database__connection__port=“${{MySQL.MYSQLPORT}}”

database__connection__user=“${{MySQL.MYSQLUSER}}”

mail__from=“redacted”

mail__options__auth__pass=“redacted”

mail__options__auth__user=“redacted”

mail__options__host=“redacted”

mail__options__port=“redacted”

mail__transport=“SMTP”

portal__url=“false”

comments__url=“false”

url=“https://mydomain.app/blog”

Request hit Ghost but it returns 404.

The error was really stupid… Since I set the Ghost config URL to https://mydomain.app/blog, it must match this URL exactly. When I used handle_path /blog*, it stripped /blog from the URL, so Ghost received https://mydomain.app, which didn’t match. Switching from handle_path to handle fixed my issue.

1 Like