Chrome and FireFox browers do not work
When reporting a bug, please provide the following details:
- swagger-ui version: master
- a swagger file reproducing the issue I pulled master and using dist to my project. It can't use in chrome and firefox browers ,and it is ok in IE brower. But it is support chrome and firefox browers in the overview. what is the matter? The error in chrome is : Refused to execute inline script because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-C8dquOZXmULUl8DCZUsQ5fjuDP/BthM9OcPt3OM26m8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'script-src' was not explicitly set, so 'default-src' is used as a fallback
Really need more details. How are you hosting your swagger-ui? Which FF and Chrome versions do you use? I just tried FF and it has no issues opening it.
I host swagger-ui in my project which supply Restful API services. My chrome version is 55.0.2883.87, and ff is 37.0.2
It is displayed OK in chrome and ff when i create index.js file which moved js code from swagger-ui/index.html. But error message still displayed in the console of chrome brower. When I test the interface, it excute fine.
Only worked for me on firefox and with a CORS addon.
Environment: Ubuntu 16.04, firefox 54.0b2 (32-bit) and chrome Versión 57.0.2987.98 (64-bit)
Why was this closed? Can someon let me know how I fix this so Swagger will work again?
@aviadpines I solved it in the following way
play.filters {
enabled += "play.filters.headers.SecurityHeadersFilter"
headers {
# The Content-Security-Policy header. If null, the header is not set.
contentSecurityPolicy = null
}
I don't think it's it the ideal way though
I had the same problem. After spending a lot of hours, i found this solution - use https://github.com/iheartradio/play-swagger, and next manual works for me: https://github.com/iheartradio/play-swagger/blob/master/docs/AlternativeSetup.md
For Play 2.6 i've used this dependency:
"com.iheart" % "play-swagger_2.12" % "0.6.2-PLAY2.6"