Bug Tracker

Modify

Ticket #11455 (closed bug: cantfix)

Opened 15 months ago

Last modified 14 months ago

Response headers unavailable on CORS ajax request

Reported by: daniel.yokomizo@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

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

comment:1 Changed 14 months ago by jaubourg

  • Status changed from new to closed
  • Resolution set to cantfix

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.