{"action":"closed","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-js/issues/679","labels_url":"https://api.github.com/repos/swagger-api/swagger-js/issues/679/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-js/issues/679/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-js/issues/679/events","html_url":"https://github.com/swagger-api/swagger-js/issues/679","id":125698192,"number":679,"title":"access-control-origin settings","user":{"login":"delenius","id":7936653,"avatar_url":"https://avatars.githubusercontent.com/u/7936653?v=3","gravatar_id":"","url":"https://api.github.com/users/delenius","html_url":"https://github.com/delenius","followers_url":"https://api.github.com/users/delenius/followers","following_url":"https://api.github.com/users/delenius/following{/other_user}","gists_url":"https://api.github.com/users/delenius/gists{/gist_id}","starred_url":"https://api.github.com/users/delenius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delenius/subscriptions","organizations_url":"https://api.github.com/users/delenius/orgs","repos_url":"https://api.github.com/users/delenius/repos","events_url":"https://api.github.com/users/delenius/events{/privacy}","received_events_url":"https://api.github.com/users/delenius/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-01-08T21:31:17Z","updated_at":"2016-01-08T23:33:13Z","closed_at":"2016-01-08T23:33:13Z","body":"When I try to initialize swagger-client with my own swagger.json, I get this error:\r\n\r\n> Can't read from server.  It may not have the appropriate access-control-origin settings.\r\n\r\nWhen I use the same code and substitute the URL\r\n\r\n> http://petstore.swagger.io/v2/swagger.json\r\n\r\nit works.\r\n\r\nThe server (on my localhost) has CORS set up. I am using the swagger jersey servlet to produce and serve the swagger.json file.\r\n\r\nIf I curl to my swagger.json URL, I get:\r\n\r\n>HTTP/1.1 200 OK\r\n>Date: Fri, 08 Jan 2016 20:58:44 GMT\r\n>Content-Type: application/json\r\n>Access-Control-Allow-Origin: *\r\n>Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS\r\n>Access-Control-Allow-Headers: Content-Type, api_key, Authorization\r\n>Content-Length: 0\r\n>Server: Jetty(9.3.5.v20151012)\r\n\r\nThis looks very similar to what I get from the \"pet store\" swagger URL:\r\n\r\n>HTTP/1.1 200 OK\r\n>Access-Control-Allow-Origin: *\r\n>Access-Control-Allow-Methods: GET, POST, DELETE, PUT\r\n>Access-Control-Allow-Headers: Content-Type, api_key, Authorization\r\n>Content-Type: application/json\r\n>Content-Length: 0\r\n>Connection: close\r\n>Server: Jetty(9.2.7.v20150116)\r\n\r\ncurl also returns the entire swagger.json document in both cases.\r\n\r\nOne additional clue. If I do \r\n\r\n> require('request')('http://localhost:8080/some/url/to/swagger.json');\r\n\r\nthen I get an error:\r\n\r\n> Error: read ECONNRESET\r\n    at exports._errnoException (util.js:856:11)\r\n    at TCP.onread (net.js:544:26)\r\n> Error: read ECONNRESET\r\n    at exports._errnoException (util.js:856:11)\r\n    at TCP.onread (net.js:544:26)\r\n\r\nCould this have something to do with the \"Connection: close\" in my response headers?"}}