Skip to content

TrafficServer 9.2.x fails to cache 200 responses after 302 redirects despite valid caching headers #12369

@shongkaikai

Description

@shongkaikai

Description:
When following 302 redirects, TrafficServer fails to cache the subsequent 200 response even when all caching conditions are met. This occurs with the documented configuration for redirect handling and caching.

Expected Behavior:
The 200 response from the final destination (http://172.16.0.89:8013/a) should be cached according to its Cache-Control: max-age=63 and Expires headers, similar to direct 200 responses.

Observed Behavior:
All requests trigger full round-trips to origin servers within the cache lifetime window (63s), indicating cache misses. Normal 200 responses (non-redirected) are cached properly.

Reproduction Steps:

Configure with record.config:

CONFIG proxy.config.http.redirect.actions STRING default:follow
CONFIG proxy.config.http.number_of_redirections INT 1
CONFIG proxy.config.http.cache.http INT 1

Make rapid sequential requests (<2s interval):

bash
curl -v 'http://172.16.0.82:2500/302/a'
Observe origin server logs showing repeated requests

first origin server response is 302:

HTTP/1.1 302 Moved Temporarily
Server: openresty/1.27.1.2
Date: Fri, 18 Jul 2025 07:59:54 GMT
Content-Type: text/html
Content-Length: 151
Connection: keep-alive
Location: http://172.16.0.89:8013/a

Final 200 response contains valid caching directives:

HTTP/1.1 200 OK
Cache-Control: max-age=63
Expires: Fri, 18 Jul 2025 08:01:58 GMT
ETag: "6867a133-9"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions