Proxy_set_header X-Time (TIME)

Hi,

I want add Current Time or Request Time in my header.

Please let me know which variable I can use in,

add_header X-Time $(TIME)
proxy_set_header X-Time $(TIME)

Thanks,
Hiren

Posted at Nginx Forum:

you can use $time_local in order to do that.

hirenshah.05 wrote in post #1040101:

Hi,

I want add Current Time or Request Time in my header.

Please let me know which variable I can use in,

add_header X-Time $(TIME)
proxy_set_header X-Time $(TIME)

Thanks,
Hiren

Posted at Nginx Forum:
proxy_set_header X-Time (TIME)

Thanks for your reply.

I tried that. But looks like $time_local is only available for Log.

It does not recognize $time_local in Server section.

May be I am missing something. Is there way to make these variable
available in anywhere in nginx conf ?

Posted at Nginx Forum:

yeah that is a good idea to use lua-nginx module or if you have built
your nginx with perl then you can have a look at this as well

http://wiki.nginx.org/EmbeddedPerlModule

It is pretty much the same idea as Brian indicated.

Brian A. wrote in post #1040119:

something like:

set_by_lua $my_time “return ngx.time()”;

something like:

set_by_lua $my_time “return ngx.time()”;

Thanks for your help.

I found this,
http://wiki.nginx.org/HttpSsiModule#.24date_gmt

I am using $date_gmt variable.

Posted at Nginx Forum:

Thanks Brian and Dhaval.

So there is no way other than installing additional module ??

Posted at Nginx Forum: