News for hackers. Stuff that matters.
Re:Demystifying CORS by matharmin on Monday June 04, 2018 @10:47AM (#17228219)
Where CORS got complicated for me was adding custom request and/or response headers to a cross-origin GET request. Different browsers handles this differently. For example, Safari would make a pre-flight request if certain request headers are sent, while Chrome would just send it. And Chrome would not make a pre-flight request, and won't populate the "Origin" request header, but will then drop "unknown" response headers (and doesn't give you any way to force a pre-flight request or Origin header). I eventually figured out you can just always respond with `Access-Control-Expose-Headers`, even though it doesn't look like a CORS request, and then Chrome will expose the headers to the JS.
Re:Demystifying CORS by bzbarsky on Monday June 04, 2018 @10:53AM (#17228281)
That's really odd. There are shared tests for all this stuff, and browsers should really be doing it identically.

Did you happen to report bugs on this to browsers? If not, do you happen to have a link to a page that shows the behavior difference?

Re:Demystifying CORS by matharmin on Monday June 04, 2018 @01:06PM (#17229850)
Nope, never got around to debug in depth. Will do that when I have some time again.
Re:Demystifying CORS by bzbarsky on Monday June 04, 2018 @03:25PM (#17231251)
Thank you! Even just a page that shows the behavior differences, without much debugging, would be really helpful; this sort of thing is something browsers very much aim to have working identically.