Skip to content

Return 206 Partial Content on Valid Range for Static Assets - #59160

Merged
javiercn merged 2 commits into
dotnet:mainfrom
melotic:justinperez/static-assets-range-fix
Nov 26, 2024
Merged

javiercn merged 2 commits into
dotnet:mainfrom
melotic:justinperez/static-assets-range-fix

Conversation

@melotic

@melotic melotic commented Nov 26, 2024

Copy link
Copy Markdown
Contributor

Currently, static assets returns a 416 Range Not Satisfiable when given a satisfiable range instead of a 206 Partial Content.

Fixes the bug and adds a test for it.

Fixes #58829


Additionally, the current logic doesn't return a 416 when the supplied range is unsatisfiable. I'll file a separate issue and PR.

@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Nov 26, 2024
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Nov 26, 2024

@javiercn javiercn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

@melotic

melotic commented Nov 26, 2024

Copy link
Copy Markdown
Contributor Author

@javiercn could you merge? I don't have permissions. Thanks

@javiercn
javiercn merged commit 3a87639 into dotnet:main Nov 26, 2024
@javiercn

Copy link
Copy Markdown
Member

@melotic thanks for the contribution!

@dotnet-policy-service dotnet-policy-service Bot added this to the 10.0-preview1 milestone Nov 26, 2024
@melotic

melotic commented Dec 4, 2024

Copy link
Copy Markdown
Contributor Author

@javiercn Thanks for the review + merge! This is an awesome feature.

I'm not familiar with the ASP.NET Core release process, but is there any chance of a bug fix release with this PR?

This is currently preventing us from enabling caching with Azure Front Door since it fetches contents in ranges. 1 The backend returns a 416 from this bug, which AFD happily forwards to clients 😢

Footnotes

  1. https://learn.microsoft.com/en-us/azure/frontdoor/front-door-caching?pivots=front-door-standard-premium#delivery-of-large-files ↩

@javiercn

javiercn commented Dec 5, 2024

Copy link
Copy Markdown
Member

@melotic I'll try to bring this for the next patch release, however, bear in mind the holidays are approaching.

@javiercn

javiercn commented Dec 5, 2024

Copy link
Copy Markdown
Member

/backport to release/9.0

@github-actions

github-actions Bot commented Dec 5, 2024

Copy link
Copy Markdown
Contributor

captainsafia pushed a commit that referenced this pull request Feb 11, 2025
…Assets (#59160)

* Return 206 Partial Content on Valid Range for Static Assets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Loading an mp4 video static asset in Blazor returns http 416 error

2 participants