title: Swagger Spring Access-Control-Allow-Origin.
body: <p>I have a Spring Swagger application and I can successfully run on localhost. But when I run the same project on Heroku I get the following error:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load <a href="http://force-com-rest-swagger.herokuapp.com/api/doc/api/v1/account" rel="nofollow">http://force-com-rest-swagger.herokuapp.com/api/doc/api/v1/account</a>. Origin <a href="https://force-com-rest-swagger.herokuapp.com" rel="nofollow">https://force-com-rest-swagger.herokuapp.com</a> is not allowed by Access-Control-Allow-Origin. </p>
  </blockquote>
  
  <p>Below is my swagger js config:</p>
  
  <pre><code>&lt;script type="text/javascript" th:inline="javascript"&gt;
      $(document).ready(function () {
  
          displaySwaggerDocuments();
  
          function displaySwaggerDocuments() {
              var url = '&lt;c:url value="/api/resourceList"/&gt;';
              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();
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>any suggestions?</p>