0 like 0 dislike
47 views
in Developers by (971 points)

How can I debug a failing redirect proxy?

  • I am building with Gatsby
  • I put the _redirects file (with one line) in /static
  • The redirect file ends up in /public which is the dir that is served
  • Locally, I cd /public and run netlify dev, I can use the proxy and see the output in the terminal
  • I deploy to the Netlify servers, the redirect is created (I can see at the top of the deploy log)
  • The redirect doesn’t work when I hit the URL, the Gatsby 404 is returned

1 Answer

0 like 0 dislike
by (971 points)

I thought I should post an update here, now that the issue has been resolved. Maybe this will be useful for anyone searching for an answer to a similar problem.

The issue we had was:

  • We were developing a new website, migrating to Netlify / Gatsby
  • Our old website was still live at the original domain
  • We assigned the domain to our account when setting it up, but had not switched the DNS to point to Netlify
  • When trying to route the proxy to our currently live (old) website, Netlify first looks up the account to see what domains are mapped to it, bypassing the DNS
  • This meant that in looking for example.org/api/myService, Netlify recognised example.org as a site that it served. It did not check the DNS and go to the currently live site. This meant that it searched for that route locally, serving up our new 404 page when that route was not found.

So to resolve this, I used a different URL to proxy through to our API service. Another resolution would be to have removed the domain from the account until we were ready to go live.

Related questions

0 like 0 dislike
1 answer 54 views
0 like 0 dislike
1 answer 5k views
0 like 0 dislike
1 answer 126 views
0 like 0 dislike
0 answers 97 views
0 like 0 dislike
1 answer 51 views
Welcome to Unwrote, where you can ask questions and receive answers from other members of the community.
...