Trouble with setting redirect for subdirectory blog

I am trying to configure a reverse proxy from my Netlify-hosted main website (baselit.ai) to my Ghost blog, which is hosted at baselit.ghost.io. I’m using Netlify redirects to handle the routing of requests to the blog subdirectory (/new-blog) to the new blog.

I have created a netlify.toml file with the following configuration:

[[redirects]]
from = "/new-blog/*"
to = "https://baselit.ghost.io/:splat"
status = 200
force = true
headers = {X-Forwarded-Host = "baselit.ai"}

[[redirects]]
from = "/new-blog"
to = "https://baselit.ghost.io/"
status = 200
force = true
headers = {X-Forwarded-Host = "baselit.ai"}

I am not able to get this to work. I have taken the following troubleshooting steps:

  • Cleared Netlify cache.
  • Reviewed the deployment logs in the Netlify dashboard, but did not find any errors related to the reverse proxy setup. I can see that 2 new redirect rules were deployed.
  • Tested the configuration on multiple browsers to rule out local caching issues.

Am I missing something?

@shubham_rana The page /new-blog is returning the same HTML as visiting any other random page that does not exist, for example /this-page-does-not-exist.

So my guess is that you also have a catch all set up for your main site like /* /index.html 200.

I’m not sure where it is located, since you’ve not mentioned it, but it must exist or that wouldn’t be happening.

You will need to ensure that these proxies to ghost.io are defined before the catch all, since the rule processing order matters as per the documentation.