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:
http://forum.nginx.org/read.php?2,220970,220970#msg-220970

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:
http://forum.nginx.org/read.php?2,220970,220970#msg-220970

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:
http://forum.nginx.org/read.php?2,220970,220975#msg-220975

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:
http://forum.nginx.org/read.php?2,220970,220980#msg-220980

Thanks Brian and Dhaval.

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

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,220970,220979#msg-220979

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs