Immer Keine 'Access-Control-Allow-Origin' mit Swagger und Vorarbeiter Rails server

Ich habe mein server läuft auf 0.0.0.0:5100. Wenn ich versuche, auf mein Swagger docs, bekomme ich die folgende Fehlermeldung in der Konsole:

XMLHttpRequest cannot load http://0.0.0.0/api/v1/types.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://0.0.0.0:5100' is therefore not allowed access. 

Frage ich mich, warum ist das passiert. Hier ist meine Konfiguration in Fors index.html:

$(function () {
      window.swaggerUi = new SwaggerUi({
      url: "/api-docs.json",
      dom_id: "swagger-ui-container",
      supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
      onComplete: function(swaggerApi, swaggerUi){
        log("Loaded SwaggerUI");

        if(typeof initOAuth == "function") {
          /*
          initOAuth({
            clientId: "your-client-id",
            realm: "your-realms",
            appName: "your-app-name"
          });
          */
        }
        $('pre code').each(function(i, e) {
          hljs.highlightBlock(e)
        });
      },
      onFailure: function(data) {
        log("Unable to Load SwaggerUI");
      },
      docExpansion: "none"
    });

InformationsquelleAutor Hommer Smith | 2014-05-08

Schreibe einen Kommentar