CloudFlare + Google Cloud Storage + React works but getting 404

cdn
#1

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 (https://www.autosharebot.com/terms), 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.

0 Likes

#2

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?

0 Likes

#3

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 (https://cloud.google.com/storage/docs/viewing-editing-metadata#edit).

0 Likes

closed #4

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

0 Likes