It turns out that I can do this with the TS Lua plugin instead of the
header rewrite plugin.
plugin.config
```
tslua.so /etc/trafficserver-second/set_origin_status.lua
```
/etc/trafficserver-second/set_origin_status.lua
```
function do_global_send_response()
local code = ts.server_response.get_status()
ts.client_response.header['X-Origin-Status'] = code
return 0
end
```
Thanks,
Hiroaki Nakamura
2016-09-28 16:36 GMT+09:00 Hiroaki Nakamura <[email protected]>:
> Hi,
>
> How to set the origin server status as a custom header?
>
> I tried the header rewrite plugin with ATS 6.2.0 with the following configs.
>
> plugin.config
> ```
> header_rewrite.so header_rewrite.config
> ```
>
>
> header_rewrite.config
>
> ```
> cond %{SEND_RESPONSE_HDR_HOOK}
> set-header X-Origin-Status %{STATUS}
> ```
>
> However I got the following response header.
>
> X-Origin-Status: 0
>
> I expected the value is 200, not 0.
>
> Thanks,
> Hiroaki Nakamura