cors icon indicating copy to clipboard operation
cors copied to clipboard

AllowAll and Access-Control-Expose-Headers.

Open yonderblue opened this issue 5 years ago • 3 comments

Just a suggestion, since wildcard for Access-Control-Expose-Headers isn't widely supported yet, I would recommend filling Access-Control-Expose-Headers in the AllowAll configuration with the result of whatever is set in the wrapped handler minus any of the 6 default values and other Access-Control-* headers.

yonderblue avatar May 16 '19 18:05 yonderblue

Would you be willing to submit a PR?

rs avatar May 23 '19 20:05 rs

Sure thing, PR up.

yonderblue avatar Jun 14 '19 22:06 yonderblue

Any update on this? I think this is causing me some issues.

bweston92 avatar Oct 15 '20 15:10 bweston92

filling Access-Control-Expose-Headers [...] with the result of whatever is set in the wrapped handler [...]

I thought about this, and I don't think it can be done. In general, the wrapped handler may write to the response body; and after that, it would be too late for the middleware to include another response header (Access-Control-Expose-Headers).

One thing you can do is include the following header:

Access-Control-Expose-Headers: *

but that's only compatible with anonymous (as opposed to credentialed) access.

jub0bs avatar Aug 27 '23 09:08 jub0bs

@rs Because Access-Control-Expose-Headers: * is now supported by all modern browsers for non-credentialed access, I think you could likely close this issue.

jub0bs avatar Dec 30 '23 22:12 jub0bs