Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger UI shows API in IE 11 and returns "Can't read from server. It may not have the appropriate access-control-origin settings." for Chrome and Firefox #1313

Closed
abelyaevskiy opened this issue May 26, 2015 · 4 comments

Comments

@abelyaevskiy
Copy link

Hello!

I faced to issue "Can't read from server. It may not have the appropriate access-control-origin settings." in Firefox (37.0.2) and Chrome (43.0.2357.65).

But in IE 11 Swagger UI shows my documented API after I click "Allow blocked content". For Chrome and Firefox browsers there are no any messages.

I tried to change useJQuery to 'true' in my swagger-client.js but it did not help me.

I use SwaggerUI v2.1.8-M1 version, Swagger 1.2 spec, com.mangofactory:swagger-springmvc:1.0.0 and org.ajar:swagger-spring-mvc-ui:0.4. also, I have OAuth2 password grant flow security in my application but for resources I tests I set permitAll() property for my first experiments with Swagger.

I test 2 resources and my class-level jsons for them are

  • {"apiVersion":"1.0","apis":[{"description":"Platform version","path":"/default/data","position":0}],"authorizations":{},"info":{"contact":"myContact","description":"This API is used to create, configure and run tasks on platform","license":"We did not choose right license by the moment","licenseUrl":"We will publish URL to license when we choose it","termsOfServiceUrl":"terms of service","title":"API"},"swaggerVersion":"1.2"}
  • {"apiVersion":"1.0","apis":[{"description":"status","path":"/default/compute","position":0}],"authorizations":{},"info":{"contact":"myContact","description":"desc","license":"We did not choose right license by the moment","licenseUrl":"We will publish URL to license when we choose it","termsOfServiceUrl":"terms of service","title":"API"},"swaggerVersion":"1.2"}

Could you please help me with the issue.

@webron
Copy link
Contributor

webron commented May 26, 2015

You need to enable CORS - https://github.com/swagger-api/swagger-ui#cors-support.

@webron
Copy link
Contributor

webron commented May 28, 2015

@abelyaevskiy - have you had a chance to look at it?

@webron
Copy link
Contributor

webron commented Jun 5, 2015

Closing due to lack of activity. Please reopen if needed.

@XaaXaaX
Copy link

XaaXaaX commented Jul 21, 2018

Hi There ,

i m getting an error and in Chrome console i got the CORS , as api is on Https , and swagger can not charge, i did all needed for CORS and ......... but nothing works

can anyone give me a ack ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants