apache / trafficserver

Apache Traffic Serverâ„¢ is a fast, scalable and extensible HTTP/1.1 and HTTP/2 compliant caching proxy server.
https://trafficserver.apache.org/
Apache License 2.0
1.82k stars 806 forks source link

The handle_cache_operation_on_forward_server_response function doesn't handle proper range operations for mismatched server and cache responses #10772

Open vmamidi opened 1 year ago

vmamidi commented 1 year ago

handle_cache_operation_on_forward_server_response sets RANGE_NOT_TRANSFORM_REQUESTED even if the server returns a response that doesn't match with the cached response. This causes ATS to send incorrect client responses.

For example, while revalidating the cached 200 response, if ATS receives a 404 response, ATS transforms the 404 response to a 206 response and sends it to the client

SolidWallOfCode commented 1 year ago

The question is whether the 404 should invalidate the cached object. Is the behavior you expect is that an error response from the upstream should invalidate the cached object? The PR consensus was this seems reasonable but we wanted clarity on the desired behavior.

mlibbey commented 1 year ago

What are the corner cases to consider? If the origin says that an object no longer exists during revalidation, when would we want to keep serving old content in cache?

vmamidi commented 1 year ago

The question is whether the 404 should invalidate the cached object. Is the behavior you expect is that an error response from the upstream should invalidate the cached object? The PR consensus was this seems reasonable but we wanted clarity on the desired behavior.

The 404 response already invalidates the cache, but ATS serves a 206 response for the request that triggers cache invalidation. Subsequent responses are then served from the cache as 404.

github-actions[bot] commented 2 weeks ago

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.