React router client side routing and cloudflare togethr

I am a react app on a server behind a free Cloudflare account using https. When using links directly do not work and return 404 error. This seems to be all the react routing is done client side and when it comes from outside there is no file at a given path. React people say create .htaccess rule to send any request to index.html and then react will take over. This is not working.
I tried some page rules but couldn’t get anything to work.

At the end of the day the problem is that you’re sending out a 404 error in your headers. Make sure your server is configured correctly.

That is what I am trying to do. .htaccess and apache.conf files do not seem to help and we think it is related to Cloudflare

Cloudflare isn’t your webhost. It’s an issue with your code base or server configuration. Cloudflare only routes DNS and offers caching/security features.

1 Like

Here I’ll give you a test. Open up your website on Cloudflare and pause service for your domain. If that helps fix your problem it’s a Cloudflare issue, otherwise it’s a server side issue.

1 Like

well I failed the test, same problem when paused. The mystery continues, but thank you!

Happy to help! :slight_smile:

on followup: so my httpd.conf is listening on port 80 and it works apart from the external linking issue
We tried changing it to myip:443 and got a website down page. Just wondering if having it listen on port 80 matters.

It does matter that you use port 80.

This topic was automatically closed after 31 days. New replies are no longer allowed.