Bug Tracker

Opened 11 years ago

Closed 11 years ago

#11455 closed bug (cantfix)

Response headers unavailable on CORS ajax request

Reported by: [email protected] Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

I have a local (i.e. file:) HTML and a localhost server. The server answers to GET requests with some application/json and accepts POST requests with application/json body, returning 200/201 + Location header on success.

The server also always sets Access-Control-Allow-Origin: *

I'm testing the HTML using Chromium, with the flag --allow-file-access-from-files.

All GET requests from the page work as expected. All POST requests from the page reach the server, but after returning the response headers are not available. The location returned is null:

var location = xhr.getResponseHeader("Location");

On the Chromium console the response headers are available. The same problem happens on Firefox. Also on Firebug I can see the response headers.

OTOH if I set up a scheme to serve the same HTML file from the server the headers are available and I can use the Location normally.

Change History (1)

comment:1 Changed 11 years ago by jaubourg

Resolution: cantfix
Status: newclosed

That's because Location is not a "simple response header": http://www.w3.org/TR/cors/#simple-response-header

As a consequence, the header is filtered out by the XHR implementation. It sucks, but it has nothing to do with jQuery.

Note: See TracTickets for help on using tickets.