CloudFlare + Google Cloud Storage + React works but getting 404

I have enabled https using Cloudflare for my site https://www.autosharebot.com which is hosted Google Cloud Storage as a static site. Everything is working if you go to the root domain but if you go to a deeper page (AutoShareBot - Automatic Content Discovery & Automatic Social Sharing), it will load but you will get a 404 in the Network Tab of Chrome DevTools

In Google Cloud Storage, I have configured the main page and 404 page to index.html.

I have also looked at this from my local development and I don’t get the same 404 issue.

I found the issue.

For some reason, Cloudflare will first perform a GET request to the /terms resource. However, this will not exist and it will automatically go to the 404 page I have set up, which uses the index.html page, which then actually loads the /terms page, since it’s an SPA.

How do I let Cloudflare (or maybe Google Cloud Storage) know that this request should not be requesting a specific resource?

Looks like best course of action is to copy index.html to the subpage url ending names (without any extension) then set the google cloud file to be the text/html content type (View and edit object metadata  |  Cloud Storage  |  Google Cloud).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.