frostnotfall opened a new issue, #9602: URL: https://github.com/apache/trafficserver/issues/9602
ATS version: 9.1.4 I use header ["cache-status"] to indicate cache hit or miss. it works fine when slice was not used. But when using the slice plugin, if the client request is not the FIRST slice, the response header ["cache-status"] always hits even if the cache does not hit. For example: slice zise: 2MB request url : http://localhost/xxxxxx.mp4 Range:bytes=2097152-4194303 Delete:  Then request again: <img width="1390" alt="image2023-4-11_16-57-18" src="https://user-images.githubusercontent.com/38377709/231337056-c7d3c1ab-2a7f-4656-a73b-6cc1e62f6f9d.png"> The access.log:   Does the response header always follow the first slice? How can I get a more accurate cache-status? Here is my configure: remap.config ``` map http://127.0.0.1/ http://x.x.x.x/ \ @plugin=slice.so @pparam=--blockbytes=2m @pparam=--remap-host=loopback map http://loopback/ http://x.x.x.x/ \ @plugin=cachekey.so @pparam=--include-headers=Range @pparam=--remove-prefix=true @pparam=--remove-all-params=true \ @plugin=cache_range_requests.so @pparam=--no-modify-cachekey @pparam=--consider-ims \ @plugin=/xxx/libexec/trafficserver/tslua.so @pparam=/xxx/etc/trafficserver/cache.lua ``` lua script: ```lua function cache_lookup() local cache_status = ts.http.get_cache_lookup_status() ts.debug(cache_status) ts.ctx['cstatus'] = cache_status end function cache_status_to_string(status) if status == TS_LUA_CACHE_LOOKUP_MISS then return "MISS" end if status == TS_LUA_CACHE_LOOKUP_HIT_FRESH then return "HIT" end if status == TS_LUA_CACHE_LOOKUP_HIT_STALE then return "MISS" end if status == TS_LUA_CACHE_LOOKUP_SKIPPED then return "PASS" end return "bug" end function gen_x_cache_int() local cache_status = cache_status_to_string(ts.ctx['cstatus']) ts.client_response.header['cache-status'] = cache_status end function do_remap() ts.hook(TS_LUA_HOOK_CACHE_LOOKUP_COMPLETE, cache_lookup) ts.hook(TS_LUA_HOOK_SEND_RESPONSE_HDR, gen_x_cache_int) return 0 end ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
