This is my stack:
- Frontend server: Node + ReactJS (
f.com
) - Backend server (API): Golang (
b.com
)
I'm doing this in development environment where I use create-react-app to run my frontend server via npm start
command. I want to perform authentication using SSO served at sso.example.com/login
. Ideally whenever there's a request to the Backend server without proper authorization, it will be responded with HTTP 302 Redirect to the SSO page. So the sequence is:
- ReactJS sends GET request to
b.com/users
- Golang responded with http.Redirect("
sso.example.com/login
") - ReactJS app gets CORS error from
sso.example.com
of which I don't have control of addingAccess-Control-Allow-Origin:*
respond header
How can I redirect my GET request successfully?