Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load resource: the server responded with a status of 403 (Forbidden) #1

Open
jamztang opened this issue Feb 17, 2017 · 0 comments

Comments

@jamztang
Copy link
Member

jamztang commented Feb 17, 2017

The problem is the outgoing request is always OPTIONS https://api.improve.ai/v1/choose if there're custom header added (for x-api-key)

ref: http://stackoverflow.com/questions/10093053/add-header-in-ajax-request-with-jquery

Trying to write my own XMLHttpRequest doesnt help as well

      var xmlHttp = new XMLHttpRequest();
      xmlHttp.onreadystatechange = function() {
          if (xmlHttp.readyState == 4)
            if (xmlHttp.status >= 200 && xmlHttp.status < 400)
              success(xmlHttp.responseText, xmlHttp.status);
            else error(xmlHttp.responseText, xmlHttp.status);
      };
      xmlHttp.open(method, theUrl, true); // true for asynchronous
      for (var key in headers) {
        xmlHttp.setRequestHeader(key, headers[key]);
      }
      xmlHttp.send(data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant