eBay / jsonpipe

A lightweight AJAX client for chunked JSON responses

Home Page:http://ebay.github.io/jsonpipe/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting "Refused to get unsafe header" errors when use in Chrome

mrkam opened this issue · comments

commented

I'm getting the following errors:

Refused to get unsafe header "Transfer-Encoding"
xhr.onreadystatechange
Refused to get unsafe header "X-Firefox-Spdy"
xhr.onreadystatechange

The are coming from process lib that's involved via xhr:

xhr.getResponseHeader('X-Firefox-Spdy')
xhr.getResponseHeader('Transfer-Encoding')

@mrkam This appears to be a CORS configuration issue. Please check if the endpoint has the CORS headers configured appropriately. The endpoint should expose the Transfer-Encoding value in the Access-Control-Expose-Headers header. Please check this stackoverflow thread for more details.

commented

Yes, CORS is the reason but I've tried other approaches like chunked-request or direct use of XMLHttpRequest and all of them didn't have this problem. Although, I can request Transfer-Encoding header to be provided but what about the other one? "X-Firefox-Spdy"? Its name sounds quite random to me.

commented

You're right, exposing Transfer-Encoding fixed the issue