I’m not sure that I can provide much more information - I’m unsure what to do to debug redirects.
The redirects file ends up in the correct location when building on local. It runs correctly when I run the netlify dev server locally.
I am as certain as I can be that the file ends up in the correct place on the server. It says that 1 redirect is created, which is what I would expect.
Is there a way I can inspect the Netlify configuration that my build generates, so I can check that the redirect has applied correctly?
I don’t use Netlify CLI, but the docs make it sound as though the netlify dev command is run for the project, not for the build folder, but I could be way off.
At any rate, have you downloaded the deploy from Netlify to see what files are being put where?
Yes, it’s an external service. The service is callable from the wider internet.
The reason I’m proxying via the _redirects file is to solve CORS issues, and migrating services ‘under the hood’.
It’s the same URL that I can hit when running Netlify CLI on my local machine. Using Postman I can hit the URL on the local machine, and wider internet. It’s just when hitting it via Netlify that I get our 404 page.
This process would be easier if you would share all the information needed to help you.
Have you tried using 200 or 200! proxy? Would it be possible for you to reveal your site URL? Would it be possible for you to reveal the contents of your redirect file?
…I still get our 404 page. I have download the deployment and verified that the _redirects file contains only this line. Strange that it works locally and performs the proxy, but not in the cloud. Any other ideas?
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.
Thanks to @fool and @gregraven for your help above. It’s appreciated!