URL rewrites not behaving as expected

I have an issue getting the rewrites to work as they should.

my _redirects file looks like this:

/static/*    https://fundbox.com/static/:splat    200
/blog/*     https://live-fundbox.pantheonsite.io/:splat    200!

I have deployed this here:

The first redirect rule doesn’t seem to work at all.
https://5dd45956b673220180419ed1--fundbox-prod.netlify.com/static/CACHE/js/d1a9d189cf67.js gives a 404
Where the actual url behind it works fine

The second rule seems to work fine
shows the blog

Anything that I’m missing? What can I do to debug this issue further?

I’ve kept testing this, and it seems that this may be due to some headers coming from the sites that doesn’t want to get proxied.

namely these:

X-Content-Type-Options: nosniff
X-permitted-cross-domain-policies: none
X-xss-protection: 1; mode=block

Can anyone confirm that this is the case?

Hi, @altryne, it appears this domain name (fundbox.com) has been added as a custom domain for this site at Netlify:


And this URL is a 404 for that site but not when the request is served by Cloudflare. Examples:

$ curl -svk  https://fundbox.com/static/CACHE/js/d1a9d189cf67.js 2>&1 1>/dev/null | grep "< HTTP"
< HTTP/2 200
# 200 at Cloudflare
$ curl -svk  https://fundbox.com/static/CACHE/js/d1a9d189cf67.js --resolve fundbox.com:443: 2>&1 1>/dev/null | grep "< HTTP"
< HTTP/2 404
# 404 at Netlify

The custom domain is not currently pointing to the Netlify site as it is being served by Cloudflare instead. However, it was added as the custom domain for the Netlify site so Netlify does attempt to load the page from our servers not Cloudflare’s.

Would you please try removing the custom domain at the custom domain settings URL (the URL above) and then trigger a new deploy? Once this is done, if the issue continues please let us know.

To summarize, I believe Netlify is trying to proxy to the domain as you have it configured at Netlify and, therefore, it isn’t actually proxying the HTTP request to correct endpoint. Removing the custom domain from the Netlify site should resolve this.

@luke sorry for the slow response here, thank you for checking into this.
I think I’ve made a mess with redirects and will have to clean up my case again and to confirm that this works.

@luke I seem to be running into the same thing again.
https://gtm3.fundbox.com/landing-pages/qbd-2019-01/ returns a 404
I’ve removed the main domain fundbox.com and it’s only this domain now.
I redeployed the site, and I’m getting a 404 on this rewrite, while the one with /blog works fine.

Let’s take a step back. We don’t recommend, or provide tech support for, folks using cloudflare in front of our CDN. Check out this article with some of the downsides:

but TL;DR we do not provide tech support for that configuration and we do not expect it to work perfectly.

We’ll be happy to support your use case as it occurs without cloudflare in front so let me know if you have reproduction steps for that and I’ll be happy to take another look. As far as I can tell, cloudflare returns a 200 there which you’re welcome to discuss with their support team, but netlify provides a 301 redirect to https://cms-gtm3.fundbox.com/landing-pages/qbd-2019-01/ as you’ve configured.

@fool you’re correct, I kept playing with the configuration of rewrites and it looks like in this case the issue was my own misconfiguration.
I have other issues that I posed about, this thread can be “resolved” I guess