Ecommerce Shopify WordPress Discussion

Deploying React App and WordPress on One CloudFront Distribution with Separate Origins and Behaviors: How-To?

I'm encountering challenges deploying both a React app and a WordPress site on the same CloudFront Distribution domain name while utilizing different origins and behaviors. Here's my setup: I have a static website hosting domain serving a React app from an S3 bucket with a Bucket website endpoint e.g http://react-example-site-build.s3-website-us-east-1.amazonaws.com Additionally, I have a WordPress site hosted on another domain. e.g http://wordpress.example.com CloudFront Distribution Origins: I've configured the CloudFront distribution with two origins: The S3 static website endpoint: react-example-site-build.s3-website-us-east-1.amazonaws.com The WordPress domain: wordpress.example.com Behaviors: In the CloudFront distribution settings, I've set up six behaviors: Five behaviors for React app routes origin: /signin /signup /user/* /forget /resetpassword One default behavior for the WordPress origin: Default(*) Additionally, for any routes not matching the React app routes mentioned above, they will redirect to the WordPress site served from the S3 static endpoint. Cache Invalidation: To handle updates, I've included the following cache invalidations: /resetpassword /user/* /forget /signin /* /signup Issues Faced: Despite the configuration, I'm encountering the following issues: 404 Errors: Initially, I faced 404 errors for React app behaviors (/signin, /signup, /user/*, /forget, /resetpassword). To address this, I added (index.html) as both the Index and Error documents in the S3 Static website hosting configuration. Although this resolved the errors, I still observe 404s in the console. User Page Display Issue: When navigating to pages under the /user/* route, initially, the content appears but quickly disappears after login. I want to understand if my logic and configuration are correct. If so, why am I encountering these issues? If not, how can I effectively deploy both the React app and WordPress site on the same CloudFront Distribution domain name with distinct origins and behaviors?
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.