Advanced CORS implementation