main: add CORS support
Merge pull request #1013 from jonboulle/1013_cors

Add CORS support