Search code examples
swaggerswagger-uiredoc

Swagger Redoc CORS issue with a json file hosted on another server


I'm trying to load a json file with redoc. That file is hosted on another server. I'm getting this error:

http://www.whatever-server.com/swagger/vs/swagger.json has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Since that file is hosted on another server, I cannot add that header on that server. I don't have access to it. I tried requesting the resource from my server instead of the browser, but then I can't resolve all the references $ref in the json file... Is there anything I can do, or is the only solution to ask the guys over at whatever-server to add that header?

Thanks


Solution

  • Swagger parser solved my problem. I was able to parse all the $ref references on the server with it.