Type: Feature Request
Status: Open (View Workflow)
Affects Version/s: None
Fix Version/s: None
Add support of Cross-Origin Resource Sharing (CORS) in Undertow.
CORS may be used to communicate client to perform cross-origin requests for resources that don't sit on the domain we performed original request against. E.g. site www.my-cool-domain.com uses some API hosted on www.cool-api.com domain. Then we can configure our server to provide CORS headers in HTTP responses from www.my-cool-domain.com which tells client that it is okay to load content from www.cool-api.com.
This could be implemented e.g. as an additional filter in Undertow.
Note that there already have been created some community implementations, see e.g.:
- undertow-cors-filter on Github by Stijn de Witt
- this implementation is created specifically for Underow creating custom HttpHandler implementation
- is configured as a filter in standalone.xml of Wildfly/EAP
- cors-filter by Vladimir Dzhuvinov
- there is a Tomcat used in examples, although its usage seems to be quite universal as it implements javax.servlet.Filter interface
- can be configured via web.xml of a deployment or via Java property file inside a deployment