Minimal example of using CORS.
Instructions for setting up demo using nginx:
- copy files from nginx.conf in /etc/nginx/conf.d/ . Be careful to modify root to clone location of repository.
- add records in /etc/hosts for redirecting cors-client.com and cors-server.com to nginx ip.
- install npm dependencies and run server:
$> cd server
$> npm install
$> node server.js
- open http://cors-client.com in browser.
The only catch is the response from the server must contain "Access-Control-Allow-Origin: http://cors-client.com" header.