|
|
|
|
|
by zmxz
1361 days ago
|
|
A web server (nginx) that can proxy your request to the other domain, but your browser sends everything to one domain, thus avoiding CORS. Example: you have http://ui.localhost and you have http://api.localhost UI speaking to API = CORS But, instead of doing fetch('http://api.localhost/resource'), you do fetch('http://ui.localhost/api/resource') In the nginx config for ui.localhost domain, you create a rule that says "everything that starts with /api, intercept it, remove /api at the start of the path and send the rest to http://api.localhost, ending up with http://api.localhost/resource" I do frontend and backend development and I have this setup with docker-compose, the config for nginx is really trivial and widely available in many tutorials. |
|