Skip to content

CORS Support

webron edited this page Dec 24, 2014 · 2 revisions

In some cases, you may need to add CORS support to enable web-based tool to function properly. This is true for swagger-ui, for example.

Remember that in some cases, your organization already provides a proxy that enables CORS support which requires no further action from you as a developer.

Using Java/Scala + servlets, you can add filter such as com.wordnik.swagger.sample.util.ApiOriginFilter.

This requires the filter being initialized in the web.xml. Please see the sample web.xml for this. Specifically, you need the bits that define the servlet filter using ApiOriginFilter and the <filter-mapping> for that filter.

Clone this wiki locally