Complete CORS implementation
Fixes issue 128