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.8k stars 798 forks source link

Status mismatch in header_rewrite #11397

Open jasmine-nahrain opened 4 months ago

jasmine-nahrain commented 4 months ago

The status parsed through resources in the exec func of a header_rewrite config can be different to the status seen in headers.

e.g.

Config #1
cond %{READ_RESPONSE_HDR_HOOK}
cond %{STATUS} = 400
  set-status 404

Config #2
cond %{READ_RESPONSE_HDR_HOOK}
cond %{STATUS} = 404
  set-status 410

If config 1 is fired first, config 2 never runs. Despite the fact that config 1 changes the status, because all rules are evaluated once before execution, the change of status is not recognised by config 2.

https://github.com/apache/trafficserver/blob/b46f5d061af455dc75956346da3308788381b30d/plugins/header_rewrite/header_rewrite.cc#L306-L319

bryancall commented 3 months ago

Verify the behavior for 8.x and if it is the same as 9.x, then we should document it.

jasmine-nahrain commented 3 months ago

Can confirm behaviour is the same in 8.1.x