Skip to main content

Bug Tracker

Side navigation

#11455 closed bug (cantfix)

Opened March 08, 2012 08:37PM UTC

Closed March 22, 2012 02:39PM UTC

Response headers unavailable on CORS ajax request

Reported by: daniel.yokomizo@gmail.com 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.

Attachments (0)
Change History (1)

Changed March 22, 2012 02:39PM UTC by jaubourg comment:1

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.