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.
[ Parent
| on HN ]
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?
Nope, never got around to debug in depth. Will do that when I have some time again.