swagger-ui: Can't read from server. It may not have the appropriate access-control-origin settings. ?
Hi,
The server returns the following message: “Can’t read from server. It may not have the appropriate access-control-origin settings.”
The API URL is: http://swagger-espn.mobovivo.com/api-docs.json
Could you please help to fix the issue?
Thanks in advance

SPEC FILE
{
"basePath": "http://espn-server.herokuapp.com/api",
"swaggerVersion": "0.1a",
"apiVersion": "1.0",
"apis": [
{
"path": "/info.json",
"format": "json",
"description": "Get API info and current match",
"operations": [
{
"httpMethod": "GET",
"summary": "Get API info and current match",
"nickname": "info",
"tags": [
"production"
],
"deprecated": false
}
]
},
{
"path": "/info/{id}.json",
"format": "json",
"description": "Get API info and current event",
"operations": [
{
"httpMethod": "GET",
"summary": "Show Event Info.",
"nickname": "showByIdOne",
"tags": [
"production"
],
"deprecated": false,
"parameters": [
{
"name": "id",
"description": "id = 1",
"dataType": "integer",
"allowMultiple": false,
"required": true,
"paramType": "path"
}
],
"errorResponses": [
{
"reason": "Not found",
"code": 404
},
{
"reason": "Invalid ID",
"code": 400
}
]
}
]
}
]
}
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 29 (11 by maintainers)
Thanks, I enabled CORS and it works! 👍
Your server is not allowing CORS requests:
In order to run the swagger-ui from a host other than mobovivo.com, you’ll have to return the proper header values for
Access-Control-Allow-MethodsandAccess-Control-Allow-Origin, like such: