You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On ATS 10.0.0 and 10.0.1-rc0, it seems that when a remap rule has number_of_redirections set to a non-zero value, the redirect itself is sometimes cached even though it is not cacheable. The "sometimes" seems to be deterministic for a given set of configuration files, but after changing something unrelated (including comments in config files), the server may flip to a state where things work as expected (redirect is not cached).
redirect_use_orig_cache_key is unset and traffic_ctl shows that it is the default (0).
Steps to reproduce:
Add a remap rule such as map http://localhost/ http://localhost/ @plugin=conf_remap.so @pparam=proxy.config.http.number_of_redirections=2
Have a webserver generate a redirect to somewhere, for example with Apache: Redirect /aaa1 http://example.com/whatever
Request the URL: curl -x http://localhost:8000 http://localhost/aaa1, note in HTTP server log that ATS fetches the redirect.
Repeat the request, note that ATS (probably) doesn't fetch the redirect again. Though sometimes it will work correctly.
(Bonus step: Try to fetch the redirect target manually through the cache, note that it gets a MISS.)
Complete debug log is included from the non-working state, I was not able to capture one from a working state. Some interesting parts:
Initial request (step 3) with the redirect fetched from origin:
[Oct 7 16:58:38.364] [ET_NET 1] DIAG: <HttpSM.cc:7789 (call_transact_and_set_next_state)> (http) [1] State Transition: SM_ACTION_API_POST_REMAP -> SM_ACTION_CACHE_LOOKUP
[Oct 7 16:58:38.364] [ET_NET 1] DIAG: <HttpSM.cc:4946 (do_cache_lookup_and_read)> (http_seq) [1] Issuing cache lookup for URL http://localhost/aaa1
[Oct 7 16:58:38.364] [ET_NET 1] DIAG: <HttpTransactCache.cc:195 (SelectFromAlternates)> (http_match) [SelectFromAlternates] # alternates = 1
[Oct 7 16:58:38.364] [ET_NET 1] DIAG: <HttpTransactCache.cc:196 (SelectFromAlternates)> (http_seq) [SelectFromAlternates] 1 alternates for this cached doc
[alts] There are 1 alternates for this request header.
…
[alts] ---- alternate #1 (Q = 1) has these request/response hdrs:
GET http://XXX.s3.amazonaws.com/aaa-assets/71321fb9c8ddca4edd3f3a7a3ac55c08eac6d0a201efae369d1eb3fa0fe96fe7/assets/XXX_assets/customer_benefits_page.html HTTP/1.1
…
[Oct 7 16:58:38.364] [ET_NET 1] DIAG: <HttpTransact.cc:2412 (HandleCacheOpenRead)> (http_trans) [1] CacheOpenRead -- hit
[Oct 7 16:58:38.364] [ET_NET 1] DIAG: <HttpTransact.cc:2413 (HandleCacheOpenRead)> (http_trans) Next action SM_ACTION_API_READ_CACHE_HDR; HandleCacheOpenReadHitFreshness
[Oct 7 16:58:38.364] [ET_NET 1] DIAG: <HttpSM.cc:7789 (call_transact_and_set_next_state)> (http) [1] State Transition: SM_ACTION_CACHE_LOOKUP -> SM_ACTION_API_READ_CACHE_HDR
So somehow the redirect target got cached at the location of the redirect. The target has a Cache-Control that allows caching, nothing relevant to this target is set in cache.config. The same thing happens regardless of whether any global plugins are enabled. This 10.0.0 was built with cmake defaults on Ubuntu 22.04, though the same thing happens when 10.0.1-rc0 is built on Debian Bookworm.
Any suggestions? I looked at the relevant code, but I'm not familiar with the internals of the HTTP state machine and couldn't see anything obviously wrong.
@cmcfarlen Was able to reproduce the issue on ATS 10.0.0. @JosiahWI thinks it might be related to PR #11542. @cmcfarlen is going to test 9.2.x and see if he can reproduce the problem on that branch.
On ATS 10.0.0 and 10.0.1-rc0, it seems that when a remap rule has
number_of_redirections
set to a non-zero value, the redirect itself is sometimes cached even though it is not cacheable. The "sometimes" seems to be deterministic for a given set of configuration files, but after changing something unrelated (including comments in config files), the server may flip to a state where things work as expected (redirect is not cached).redirect_use_orig_cache_key
is unset and traffic_ctl shows that it is the default (0).Steps to reproduce:
map http://localhost/ http://localhost/ @plugin=conf_remap.so @pparam=proxy.config.http.number_of_redirections=2
Redirect /aaa1 http://example.com/whatever
curl -x http://localhost:8000 http://localhost/aaa1
, note in HTTP server log that ATS fetches the redirect.Complete debug log is included from the non-working state, I was not able to capture one from a working state. Some interesting parts:
Initial request (step 3) with the redirect fetched from origin:
Redirect is followed and the target is written:
Second request (step 4):
So somehow the redirect target got cached at the location of the redirect. The target has a
Cache-Control
that allows caching, nothing relevant to this target is set incache.config
. The same thing happens regardless of whether any global plugins are enabled. This 10.0.0 was built with cmake defaults on Ubuntu 22.04, though the same thing happens when 10.0.1-rc0 is built on Debian Bookworm.Any suggestions? I looked at the relevant code, but I'm not familiar with the internals of the HTTP state machine and couldn't see anything obviously wrong.
log.txt
The text was updated successfully, but these errors were encountered: