Missing trailing slash - redirect not working

I’m using a splat rewrite to pretend that the app on artis-dev-2-cms.herokuapp.com/ghost exists on new.artis.dev/ghost.

With the Netlify splat rewrite below everything works perfectly as long as the URL contains the trailing slash exactly like new.artis.dev/ghost/.

The problem is when you don’t have the trailing slash in new.artis.dev/ghost. The rewrite loses the entire ghost part and the rest of the requests get messed up like in the screenshot.

I have tried countless combinations in the _reddirects file of /ghost /ghost/ before and after and variations of these I could think of but I only ever get an infinite redirect loop or this error with the missing segment.

  • Netlify URL: new-artis-dev.netlify.app
  • Custom domain URL: new.artis.dev
  • Contents of _redirects file: /ghost/* https://artis-dev-2-cms.herokuapp.com/ghost/:splat 200!

Hey @artis-dev,

From what I can gather, you’re proxying from Heroku and that’s fine. You’re doing what the docs suggest – with the exception of the forced 200 rule.

Though I don’t understand how, with that rule, you’ll ever get a request which doesn’t start with new.artis.dev/ghost/. Furthermore, Ghost doesn’t seem to have changed behaviour. Interesting!

At this point, I suggest that you change the rule to: /ghost/* https://artis-dev-2-cms.herokuapp.com/ghost/:splat 200. I don’t suppose this helps?

If not, can I ask that you provide a couple more reproduction steps and grab the NF-Request-ID from the response headers?