bryancall commented on issue #9796:
URL: https://github.com/apache/trafficserver/issues/9796#issuecomment-4008618639

   There's no built-in "cache-only" mode in ATS. The challenge is that the 
remap destination is part of the cache key, so you can't point the remap at a 
dummy origin without breaking cache key alignment with your PUSH requests.
   
   A few approaches depending on your version:
   
   1. **Plugin approach (cleanest):** A plugin on 
`TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK` can detect a cache miss and return a 404 
immediately, without attempting an origin connection. On ATS 10.x+, this is 
straightforward with a Cript.
   
   2. **Lightweight origin:** Run a minimal HTTP server on the origin host that 
returns 404 for all requests. On a cache miss, ATS connects to the origin, gets 
a 404, and returns it to the client. On a cache hit (from PUSH), the cached 
content is served normally. This works on any ATS version with no plugins 
needed.
   
   3. **header_rewrite (partial):** You can use `cond %{CACHE} =miss` with 
`set-status 404` and `set-body "Not Found"` on `SEND_RESPONSE_HDR_HOOK` to 
rewrite the response, but this only fires *after* the origin connection 
attempt, so it doesn't prevent the round-trip. There's no cache lookup complete 
hook available in header_rewrite to short-circuit earlier.
   
   Note that 7.1.x has been end-of-life for several years. If you're still 
working on this use case, upgrading to a current release is recommended.
   
   Closing this out given the age. Feel free to reopen or file a new issue if 
you have further questions.
   


-- 
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]

Reply via email to