Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$http GET turns into OPTIONS #1585

@alexeygolev

Description

@alexeygolev

Even taking all the client side and server side issues of CORS into account I'm still not managing to make it work.

This works

         $.ajax({
            type:"GET",
            url: "https://website.com/getProfile",
            xhrFields: {
               withCredentials: true
            },
            crossDomain: true
        }).done(function ( data ) {
              if( console && console.log ) {
              console.log(data);
            }
      });

however this doesn't

      $http.defaults.useXDomain = true;
      $http({
          method: "GET",
          url: "https://website.com/getProfile",
          withCredentials: true,
          }).success(
              function(data, status, headers, config) {
                console.log(data);
              }).error(function(data, status, headers, config) {
                console.log(data);
               });

The latter turns GET request into pending OPTIONS request. What am I missing? It can't be a bug can it?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions