Send TR time in response of request

I am currently doing a POC on haproxy.
Haproxy gives the TR time which is time required to receive the first byte of header to last byte of header.
I want to use this TR time for my purpose.
I want haproxy to return TR time in response without going to backend server.

To send TR time in response
I am using following modification in frontend

http-after-response set-header tproxy "%TR"

But in response I am getting -1 for TR whereas if I use log-format then it prints the correct value

tproxy
	-1

How do I get the correct TR value in response of my request

Please stop tagging me. Thank you.

You probably need to save the TR value in the frontend into a txn variable, and add it to the response in the backend section by accessing that txn variable.

Otherwise, when you are adding the value to the response, the TR value may not be available anymore.