Added CORS detection and support