CORS-Anfrage - Warum werden die Cookies nicht gesendet?

Habe ich eine cross-domain-AJAX HOLEN, die bekommt pre-flighted erfolgreich, aber die cookies nicht befestigt bekommen die GET-Anforderung.
Wenn der Benutzer auf eine Schaltfläche anmelden, einen POST gemacht zum anmelden der Benutzer an, die ordnungsgemäß funktioniert cross-domain. Das JavaScript ist:

        $.ajax(signin_url, {
            type: "POST",
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(credentials),
            success: function(data, status, xhr) {
                signInSuccess();
            },
            error: function(xhr, status, error) {
                signInFailure();
            },
            beforeSend: function(xhr) {
                xhr.withCredentials = true
            }
        });

Den response-Header enthalten eine cookie:

Set-Cookie:user_token=snippysnipsnip; path=/; expires=Wed, 14-Jan-2032 16:16:49 GMT

Wenn Anmeldung erfolgreich, wird eine JavaScript-GET-Anforderung aus, um die aktuelle Benutzer-details:

function signInSuccess() {
    $.ajax(current_user_url, {
        type: "GET",
        contentType: "application/json; charset=utf-8",
        success: function(data, status, xhr) {
            displayWelcomeMessage();
        },
        beforeSend: function(xhr) {
            xhr.withCredentials = true;
        }
    });
}

Den CORS-bedingten Header zurückgegeben, die von Chrome-OPTIONEN auf Wunsch sind:

Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:X-Requested-With, X-Prototype-Version, Content-Type, Origin, Allow
Access-Control-Allow-Methods:POST, GET, OPTIONS
Access-Control-Allow-Origin:http://192.168.0.5
Access-Control-Max-Age:1728000

Jedoch werden keine cookies gesendet werden, auf die GET-Anforderung.

InformationsquelleAutor der Frage jim_vx | 2012-01-14

Schreibe einen Kommentar