React JS website on AWS S3, not working through Cloudflare

I’m hosting a React JS webapp on AWS S3 as a static website. Inside the webapp, it is using the path parameters from the URL, to process some information.
When using Cloudflare as a proxy for the S3 static website, I’m getting 404 error, due to the path parameters.

  • Code: NoSuchKey
  • Message: The specified key does not exist.

I’ve used the given tutorials for using Cloudflare to enable https for a static website in AWS S3.

Directly using the AWS S3 static website URL (http) works perfectly fine and the webapp runs as expected. It doesn’t work through the https Cloudflare URL.

Any help is greatly appreciated.


Doesn’t AWS S3 have the HTTPS url version too?

Unfortunately, no, it has to be combined with some other AWS services to be able to use https for this particular use case where a static website is hosted on S3.

For anyone who may be facing this same issue, a simple solution I found after multiple hit-and-trials was to set the optional “error document” configuration on the AWS S3 bucket to index.html. This is an optional parameter in the bucket properties, where we enable static website hosting in AWS S3. This configuration redirects any errors back to index.html which then handles the path parameters and query string parameters, as expected.

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