Reputation: 7156
I have s3 serving my React App. Whats the best way to redirect any requests that have /api in the url to my webserver. Currently my CORS config in S3 redirects GET only and I know this is not the correct way to handle api endpoints.
somedomain.com -> serve static s3 react app
somedomain.com/api -> send requests to webapp (hosted at api.somedomain.com)
My other option is to just let nginx handle serving the app and api.
Upvotes: 0
Views: 227
Reputation: 13035
Use Cloud Front and Change the incoming patterns to different origin.
Upvotes: 4
Reputation: 4197
A static website hosted on Bitbucket will only allow (and redirect) GET requests.
I'd recommend you set the api.somedomain.com
as your api endpoint in your JS. This would avoid the need for the /api
route.
Upvotes: 0