Closed thysmichels closed 10 years ago
I have a Spring MVC swagger project that is working on localhost but when I deploy it to Heroku I get the following error:
XMLHttpRequest cannot load http://force-com-rest-swagger.herokuapp.com/api/doc/api/v1/account. Origin https://force-com-rest-swagger.herokuapp.com is not allowed by Access-Control-Allow-Origin.
Here is my Swagger js config:
$(document).ready(function () { displaySwaggerDocuments(); function displaySwaggerDocuments() { var url = '<c:url value="/api/resourceList"/>'; window.swaggerUi = new SwaggerUi({ discoveryUrl: url, dom_id: "swagger-ui-container", supportHeaderParams: false, supportedSubmitMethods: ['get', 'post', 'put', 'delete'], apiKey: "", onComplete: function (swaggerApi, swaggerUi) { if (console) { console.log("Loaded SwaggerUI") console.log(swaggerApi); console.log(swaggerUi); } $('pre code').each(function (i, e) { hljs.highlightBlock(e) }); }, onFailure: function (data) { if (console) { console.log("Unable to Load SwaggerUI"); console.log(data); } }, docExpansion: "none" }); window.swaggerUi.load(); } });
Any suggestions?
I tried to set my discoveryUrl to http://force-com-rest-swagger.herokuapp.com/ and also supportHeaderParams=true but it still gives the same error.
I solved this by specifying the setBasePath("https://force-com-rest-swagger.herokuapp.com");
I have a Spring MVC swagger project that is working on localhost but when I deploy it to Heroku I get the following error:
XMLHttpRequest cannot load http://force-com-rest-swagger.herokuapp.com/api/doc/api/v1/account. Origin https://force-com-rest-swagger.herokuapp.com is not allowed by Access-Control-Allow-Origin.
Here is my Swagger js config:
Any suggestions?
I tried to set my discoveryUrl to http://force-com-rest-swagger.herokuapp.com/ and also supportHeaderParams=true but it still gives the same error.
Any suggestions?