petruisfan / cors-demo

Minimal example of using cors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cors demo

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

The only catch is the response from the server must contain "Access-Control-Allow-Origin: http://cors-client.com" header.

About

Minimal example of using cors

License:Apache License 2.0


Languages

Language:HTML 84.0%Language:JavaScript 16.0%