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

Set Accept-Ranges: none header when compressing responses #229

Open
palant opened this issue May 6, 2024 · 0 comments
Open

Set Accept-Ranges: none header when compressing responses #229

palant opened this issue May 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@palant
Copy link

palant commented May 6, 2024

What is the problem your feature solves, or the need it fulfills?

When adjusting response headers, ResponseCompressionCtx will currently remove the Content-Length header as the old header does not apply. A potentially present Accept-Ranges: bytes header is left untouched however, even though ranged requests no longer make sense.

Describe the solution you'd like

Call resp.insert_header(&ACCEPT_RANGES, HeaderValue::from_static("none")) when compressing. This will both overwrite any existing Accept-Ranges header and explicitly indicate to the client that ranged requests are unsupported.

Describe alternatives you've considered

N/A

Additional context

Accept-Ranges header spec

@palant palant changed the title Set Accept-Ranges: none when compressing responses Set Accept-Ranges: none header when compressing responses May 7, 2024
@andrewhavck andrewhavck added the enhancement New feature or request label May 9, 2024
@eaufavor eaufavor added bug Something isn't working and removed enhancement New feature or request labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants