Redirects work as expected on default URL but not on my custom domain

Hello, I’m new to netlify and have had some problems getting my site working. I’m using a serverless express backend and create-react-app for the client.

It’s a pretty odd issue-- when I deploy the site to production at this url: https://honkurls.netlify.app/, everything works exactly as expected. It’s a url shortener, so https://honkurls.netlify.app/ goes to the homepage and https://honkurls.netlify.app/yt redirects to the express app where it redirects to a youtube link or whatever.

However, when accessing it via the custom domain I set up, https://honk.gq, it redirects to /.netlify/functions/server/ (where the express app is) regardless of whether or not a path is specified. This results in the error Cannot GET /.netlify/functions/server/.

The expected behavior is for this redirect only to occur if there’s something after the / in the url so that the client can be redirected. (because it redirects either way, shortened urls do work e.g. https://honk.gq/yt redirects to youtube.)

I imagine it has something to do with the _redirect file, but at the same time it’s odd that it works on the default url but not on the custom one. At any rate, here’s the contents of my _redirect:

/home /
/* /.netlify/functions/server/:splat

I’m not sure what I’m doing wrong but any help or suggestions would be really appreciated, this has been giving me a headache for hours :sweat_smile:

EDIT: Also, I’ve sent the honk.gq link so some friends and they report that it works as normal. I tried it in another browser and it worked there, but it’s still not working in my main browser.
It’s the same for them now. Only the https://honkurls.netlify.app/ link works.

Hey there! I can see that the index.html is now being served at https://honk.gq.

With your /* /.netlify/functions/server/:splat rule, you would get the error if:

  • index.html wasn’t available (most likely)
  • You had a force in your redirect rule (in a _redirects file, this is denoted with a ! after the status code, such as 301!, which doesn’t appear to be the case given your rule… or a force: true in netlify.toml) - the force ensures that ALL traffic, even to pages which exist, are remapped

Thanks for your response! However, I’m still having the issue.

Oh, I did actually have a force: true in netlify.toml from when I was trying to get it to redirect earlier but it wasn’t working and I guess I forgot to remove it. However, it doesn’t seem to have done anything differently now that it’s gone.

I’m not sure as to why index.html wouldn’t be available? It does appear in the publish directory I specified once building is done.

Do you have any other ideas for things to try?

Seems like my changes just took a while to propagate. Woke up today and everything works on my custom domain the way they do on the netlify one.

If anyone has a similar issue definitely make sure to try what pieparker mentioned in his reply but also keep in mind you may have to wait a bit for the changes to take place.