Skip to content

Conversation

@jtbandes
Copy link

@jtbandes jtbandes commented Oct 22, 2024

By default, browsers only allow clients to read CORS-safelisted response headers. However, sometimes it is useful to read other headers that are not safelisted by default, such as Accept-Ranges. The Access-Control-Expose-Headers header allows controlling which headers are exposed to the client.

This change exposes all headers (*) when --cors is used.

It could be useful to allow more fine-grained configuration of exposed headers, however, it seems that the existing --cors mode is a very coarse toggle so I just used * for consistency.

I didn't see a relevant place to update docs – is this tool missing documentation for the CLI flags?

By default, browsers only allow clients to read "CORS-safelisted response headers": https://developer.mozilla.org/en-US/docs/Glossary/CORS-safelisted_response_header However, sometimes it is useful to read other headers that are not safelisted by default, such as `Accept-Ranges`. The `Access-Control-Expose-Headers` header allows controlling which headers are exposed to the client. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers This change exposes all headers when `--cors` is used.
@jtbandes
Copy link
Author

Friendly ping @AndyBitz @leo -- any interest in this patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant