trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

background_fetch plugin requires origin support 206s

Open traeak opened this issue 4 years ago • 2 comments

Given an origin that does not support range requests (replies 200 to range requests). remap rule configured with background_fetch plugin. CONFIG proxy.config.http.cache.range.lookup INT 1

make range request through ATS. response will be 200. background_fetch plugin ignores because it only considers 206 responses. ATS doesn't cache the 200 response (maybe it decided the response wasn't going to be cacheable?).

Until a client requests a full GET to the asset 206 requests will always be served as 200s by the origin.

traeak avatar Jun 22 '21 19:06 traeak

Workaround is to add 2 header rewrites, one before and one after the background_fetch plugin with example rewrites:

before:

cond %{READ_RESPONSE_HDR_HOOK}
cond %{CLIENT-HEADER:Range} = "" [NOT]
cond %{STATUS} = 200
set-status 206
set-header @Was200 true

after:

cond %{SEND_RESPONSE_HDR_HOOK}
cond %{HEADER:@Was200} = "" [NOT]
set-status 200

traeak avatar Jun 24 '21 18:06 traeak

This issue has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.

github-actions[bot] avatar Jun 29 '22 02:06 github-actions[bot]