trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

Status mismatch in header_rewrite

Open jasmine-nahrain opened this issue 1 year ago • 3 comments

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

jasmine-nahrain avatar May 28 '24 06:05 jasmine-nahrain

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

bryancall avatar Jun 03 '24 22:06 bryancall

Can confirm behaviour is the same in 8.1.x

jasmine-nahrain avatar Jun 17 '24 22:06 jasmine-nahrain

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.

github-actions[bot] avatar Jun 18 '25 02:06 github-actions[bot]