← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 987044] Re: OpenStack APIs should support CORS to be usable from Javascript

 

** Changed in: nova
       Status: Confirmed => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/987044

Title:
  OpenStack APIs should support CORS to be usable from Javascript

Status in OpenStack Compute (Nova):
  Invalid

Bug description:
  OpenStack does not support CORS (http://en.wikipedia.org/wiki/Cross-
  origin_resource_sharing).

  That means that any API which requires a POST request cannot be used
  from Javascript in a browser unless it is served from the same domain
  and port as the API is served from.

  There doesn't seem to be a reason for this - the APIs are specifically
  designed to be called from other domains, so I suspect this is just an
  oversight.

  Here is sample code that I think should be supported. It fails on the
  OPTIONS request (which occurs with Cross Domain XMLHttpRequests to
  check that the server supports them)

  
  <html>

  <body>
      <button onclick="go()">Try It</button>

  
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js";></script>
  <script type="text/javascript">
   
  function go() {
      osuser = "username"
      ospassword = "password"
      
      params = '{"auth":{"passwordCredentials":{"username":"'+osuser+'", "password":"'+ospassword+'"}}}'
      
      $.ajax({
          url: "nova-api.trystack.org:5443/v2.0/tokens",
          type: 'POST',
          headers: {"Content-Type": "application/json"},
          data: params,
          success: function(data) { alert(data); }
      });
  }

  </script>
   
  </body>

  </html>

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/987044/+subscriptions