Chrome not adding headers in ajax requests from iframe, Firefox ok

Viewed 959

I've got a situation where I'm sending ajax requests from iframe, to same domain as original page, this Iframe loaded from same domain. Say, original page address is http://server/client and iframe src is http://server/client/addin1/view.html

From Iframe I make initial xhr request to api: POST http://server/api/connect which returns 201 with token in response header and a cookie. Now I make next call to different api method, say, GET http://server/api/status, but in this case I add the token header, and I assume the received cookie will be included by browser - it's HttpOnly, my xhr has withCredentials: true.

The magic is: in FF it works ok, both token and cookie are set and sent, in chrome the token header is not added and cookie is not sent. I've verified that in both cases xhr.setRequestHeader(...) gets called, and just to be 100% sure I've verified with wireshark what gets actually sent.

Any idea why chrome, behaves differently from FF? Maybe I'm missing sth simple.

thanks, Łukasz

1 Answers
Related