Inserting timestamp to HTTP header

Hello,

I would like to insert HTTP header value that reflects the current time of the requested connection and send it to backend servers.

I need help for inserting timestamp and the time format (GMT +2).

I’ve used iRules like this: when HTTP_REQUEST { set http_request_time [clock format [clock seconds] -gmt 2 ] }

Is that correct? Thanks.

Hello,

You can use that code:

when CLIENT_ACCEPTED {
        set time [clock format [clock seconds] -format "%d/%b/%Y:%H:%M:%S %z"]
    }
    when HTTP_REQUEST {
        HTTP::header insert "X-Time" "$time"
    }

you can use this code when CLIENT_ACCEPTED { set time [clock format [clock seconds] -format “%d/%b/%Y:%H:%M:%S %z”] } when HTTP_REQUEST { HTTP::header insert “X-Time” “$time” } joe root hr@ Finance Assignment Help

when HTTP_REQUEST { set secs [clock seconds] set msec [clock clicks -milliseconds] set base [expr { $secs * 1000 } ] set fract [expr { $msec - $base }] if { $fract >= 1000 } { set diff [expr { $fract / 1000 }] incr secs $diff incr fract [expr { -1000 * $diff }] } set time [clock format $secs -format “%d/%b/%Y:%H:%M:%S.$fract,000 %Z”] HTTP::header replace “X-Time” “$time” } you can use this code. PSD to Wordpress Conversion Service