Wie sieht eine Preflight-HTTP-Anforderung aus, wenn Sie Basic Auth einschließen? Wie die folgende Unterhaltung? Im mit Mühe zu verstehen, welche Header gesendet werden müssen, wo, auch weil es nicht möglich, es mit Firebug richtig zu debuggenCORS und HTTP basic auth
Auftraggeber:
OPTIONS /api/resource HTTP/1.1
Access-Control-Request-Method: GET
Origin: http://jsconsole.com
Server:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, PUT, DELETE
Access-Control-Allow-Headers: Authorization
Access-Control-Max-Age: 1728000
Access-Control-Allow-Credentials: true
Auftraggeber:
GET /api/resource HTTP/1.1
Access-Control-Request-Method: GET
Access-Control-Allow-Credentials: true
Origin: http://jsconsole.com
Server:
HTTP/1.1 401 Unauthorized
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, PUT, DELETE
Access-Control-Allow-Headers: Authorization
Access-Control-Max-Age: 1728000
Access-Control-Allow-Credentials: true
WWW-Authenticate: Basic realm="Authorisation Required"
Auftraggeber:
GET /api/resource HTTP/1.1
Access-Control-Allow-Credentials: true
Authorization: Basic base64encodedUserAndPassword
Access-Control-Request-Method: GET
Origin: http://jsconsole.com
Server:
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, PUT, DELETE
Access-Control-Allow-Headers: Authorization
Access-Control-Max-Age: 1728000
Access-Control-Allow-Credentials: true
Siehe „CORS mit grundlegenden auth“ Abschnitt etwas auf halbem Weg durch den Artikel bei http://avalanche123.com/blog/2011/10/10/cross-domain-javascript-lessons-learned/ –
Leider Lawinen Blog Eintrag ist veraltet. Chrome unterstützt grundlegende Auth. IE jedoch nicht, wenn Sie mit den Sicherheitseinstellungen herumspielen. – ianbeks