-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Keith Donald opened SPR-9278 and commented
Cross origin resource sharing (CORS) is a relevant spec these days with the emergence of HTML5 & JS clients that consume data via REST APIs. For a given app, in many cases the host that serves the JS (e.g. foo.com) is different than the host that serves the data (e.g. api.foo.com). In this case, CORS can enable the cross-domain communication.
It would be useful if Spring MVC provided code & guidance on how to configure CORS when implementing a Java-backed REST API consumed by JS clients located in other domains. Prior work exists that would be a candidate for integration.
See the resources below:
CORS Spec: http://www.w3.org/TR/cors/
Basic example of a CorsFilter implementation: https://gist.github.com/2232095
What appears to be a full-featured CorsFilter implementation: https://bitbucket.org/jsumners/corsfilter
Affects: 3.1.1
Sub-tasks:
- DefaultCorsProcessor relies on Servlet 3 specific methods [SPR-12885] #17483 DefaultCorsProcessor relies on Servlet 3 specific methods
- Invalid CORS requests should not been rejected [SPR-12930] #17523 Invalid CORS requests should not been rejected
- CorsConfiguration should not be registered for handler methods without @CrossOrigin [SPR-12931] #17524 CorsConfiguration should not be registered for handler methods without
@CrossOrigin - Add global CORS configuration capabilities [SPR-12933] #17526 Add global CORS configuration capabilities
Issue Links:
- DATAREST-333 Handle OPTIONS request for CORS
- Undocumented auto CORS for websocket endpoint breaking existing CORS code [SPR-11437] #16063 Undocumented auto CORS for websocket endpoint breaking existing CORS code
- SEC-2273 CORS Suport
- Comprehensive strategy for securing Origins in web transports [SPR-12316] #16921 Comprehensive strategy for securing Origins in web transports
26 votes, 34 watchers