Avoid CORS requests for a React App

A typical web application architecture

Problem #1

Pre-flight OPTIONS call

Soluion #1

If you’d like to send Authorization headers, your server had better be configured to allow it. Set your server up so it responds to an OPTIONS request at that url with an Access-Control-Allow-Headers: Authorization header.

Problem #2

Soluion #2

Access-Control-Allow-Origin: http://app.example.com

Solution #3

Solution #4

"proxy": "api.exampple.com",

--

--

--

Lead Android Developer, Flutter Lover

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nabil Mosharraf Hossain

Nabil Mosharraf Hossain

Lead Android Developer, Flutter Lover

More from Medium

React and Redux simplified.

React.js: The most prevalent front-end JavaScript library for building Web applications

Best Practices For Inline Style In React.Js