I have a REST api running at http://localhost:8080/MyService
and can see the JSON produced by swagger at http://localhost:8080/MyService/api-docs
. In the Servers project in eclipse I have modified web.xml to include the Cors filter:
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
but when I point swagger-ui (loaded in browser from file system) at http://localhost:8080/MyService/api-docs
, I get the following error:
Can't read from server. It may not have the appropriate access-control-origin settings.
Adding the Swagger dist directly to the webapps folder did the trick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With