Skip to content

Commit d71a0c3

Browse files
Copilotjaviercn
andcommitted
Remove Accept-Ranges header from DefineStaticWebAssetEndpoints and update baselines
Co-authored-by: javiercn <[email protected]>
1 parent 230fa2a commit d71a0c3

File tree

72 files changed

+129
-36060
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+129
-36060
lines changed

src/StaticWebAssetsSdk/Tasks/DefineStaticWebAssetEndpoints.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,8 @@ private void CreateAnAddEndpoints(
125125
foreach (var (label, route, values) in _resolvedRoutes)
126126
{
127127
var (mimeType, cacheSetting) = ResolveContentType(asset, ContentTypeProvider, matchContext, Log);
128-
var headers = new StaticWebAssetEndpointResponseHeader[6]
128+
var headers = new StaticWebAssetEndpointResponseHeader[5]
129129
{
130-
new()
131-
{
132-
Name = "Accept-Ranges",
133-
Value = "bytes"
134-
},
135130
new()
136131
{
137132
Name = "Content-Length",
@@ -159,14 +154,14 @@ private void CreateAnAddEndpoints(
159154
{
160155
// max-age=31536000 is one year in seconds. immutable means that the asset will never change.
161156
// max-age is for browsers that do not support immutable.
162-
headers[5] = new() { Name = "Cache-Control", Value = "max-age=31536000, immutable" };
157+
headers[4] = new() { Name = "Cache-Control", Value = "max-age=31536000, immutable" };
163158
}
164159
else
165160
{
166161
// Force revalidation on non-fingerprinted assets. We can be more granular here and have rules based on the content type.
167162
// These values can later be changed at runtime by modifying the endpoint. For example, it might be safer to cache images
168163
// for a longer period of time than scripts or stylesheets.
169-
headers[5] = new() { Name = "Cache-Control", Value = !string.IsNullOrEmpty(cacheSetting) ? cacheSetting : "no-cache" };
164+
headers[4] = new() { Name = "Cache-Control", Value = !string.IsNullOrEmpty(cacheSetting) ? cacheSetting : "no-cache" };
170165
}
171166

172167
var properties = new StaticWebAssetEndpointProperty[values.Count + (values.Count > 0 ? 2 : 1)];

0 commit comments

Comments
 (0)