Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access-Control-Expose-Headers: ETag CORS header #89

Open
NoUDerp opened this issue May 13, 2021 · 4 comments
Open

Access-Control-Expose-Headers: ETag CORS header #89

NoUDerp opened this issue May 13, 2021 · 4 comments
Labels
API Issue Something seems wrong with the API Feature Request For feature requests

Comments

@NoUDerp
Copy link

NoUDerp commented May 13, 2021

While the access-control-allow-origin header is set to all, allowing CORS requests, the ETag header is not visible to client-side Javascript due to the CORS standard: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers

The server must provide an explicit white listing of valid http headers that the client-side Javascript is able to see, and ETag is not one of the default visible headers - it is stripped out by the browser.

I'd like to make use of the ETag header in the prescribed way but have no way of seeing it client-side without this header provided by the server.

The easy solution is adding an additional http header "Access-Control-Expose-Headers: ETag" or "Access-Control-Expose-Headers: *"

@hayden-t
Copy link

'the server' is that yours or clapfoots ? i had similar topic with my node js script, i had to set cors origin to my domain with the sse channel library i was using

@NoUDerp
Copy link
Author

NoUDerp commented May 13, 2021

I have no server, it's a web app. The cross site scripting is enabled, but specifically the ETag not being enabled prevents me from using the cache mechanism (which I can store with localStorage).

@hayden-t
Copy link

ah ok

@philipdiehl1 philipdiehl1 added API Issue Something seems wrong with the API Feature Request For feature requests labels May 31, 2021
@S0yKaf
Copy link

S0yKaf commented Sep 11, 2023

Same issue here. if requests are made to the API on the client side, CORS settings will not show the Etag header. You need to expose this header otherwise client side apps have no way of making use of the Etag feature.

I'm forced to always refresh the full dynamic list every time I check if the map updated. pretty wasteful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Issue Something seems wrong with the API Feature Request For feature requests
Projects
None yet
Development

No branches or pull requests

4 participants