You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Leif Hedstrom (JIRA)" <ji...@apache.org> on 2016/01/25 20:02:39 UTC

[jira] [Comment Edited] (TS-2642) header_rewrite Time based Rules

    [ https://issues.apache.org/jira/browse/TS-2642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15115772#comment-15115772 ] 

Leif Hedstrom edited comment on TS-2642 at 1/25/16 7:01 PM:
------------------------------------------------------------

Here's an example usage:

{code}
cond %{SEND_RESPONSE_HDR_HOOK} [AND]
cond %{NOW} >1453484915
     set-header X-Now %{NOW}
     set-header X-Now-Year %{NOW:YEAR}
     set-header X-Now-Month %{NOW:MONTH}
     set-header X-Now-Day %{NOW:DAY}
     set-header X-Now-Hour %{NOW:HOUR}
     set-header X-Now-Min %{NOW:MINUTE}
     set-header X-Now-WEEKDAY %{NOW:WEEKDAY}
     set-header X-Now-YEARDAY %{NOW:YEARDAY}
{code}

which produces

{code}
X-Now: 1453748342
X-Now-Year: 2016
X-Now-Month: 0
X-Now-Day: 25
X-Now-Hour: 11
X-Now-Min: 59
X-Now-WEEKDAY: 1
X-Now-YEARDAY: 24
{code}

Obviously the NOW with qualifiers can be use be used in conditional expressions as well, e.g.

{code}
cond %{NOW:YEARDAY} >31 [OR]
cond %{NOW:YEAR} >2016
{code}


was (Author: zwoop):
Here's an example usage:

{code}
cond %{SEND_RESPONSE_HDR_HOOK} [AND]
cond %{NOW} >1453484915
     set-header X-Now %{NOW}
     set-header X-Now-Year %{NOW:YEAR}
     set-header X-Now-Month %{NOW:MONTH}
     set-header X-Now-Day %{NOW:DAY}
     set-header X-Now-Hour %{NOW:HOUR}
     set-header X-Now-Min %{NOW:MINUTE}
     set-header X-Now-WEEKDAY %{NOW:WEEKDAY}
     set-header X-Now-YEARDAY %{NOW:YEARDAY}
{code}

which produces

{code}
X-Now: 1453748342
X-Now-Year: 2016
X-Now-Month: 0
X-Now-Day: 25
X-Now-Hour: 11
X-Now-Min: 59
X-Now-WEEKDAY: 1
X-Now-YEARDAY: 24
{code}

> header_rewrite Time based Rules
> -------------------------------
>
>                 Key: TS-2642
>                 URL: https://issues.apache.org/jira/browse/TS-2642
>             Project: Traffic Server
>          Issue Type: New Feature
>          Components: Performance, Plugins
>            Reporter: Faysal Banna
>            Assignee: Leif Hedstrom
>             Fix For: 6.2.0
>
>
> Hi Guys.
> with the great stuff in header_rewrite plugin there comes an issue which arises. 
> Header rewrite plugin can modify configurable options based upon the condition rules and logic we use inside it. 
> the feature am asking for is to add timing condition for those rules 
> example 
> cond %{time} >1600 [AND]
> cond %{time} <2000 
> cond %{time:day} =6
> ....
> .....
> ....
> .... [L]
> where day<= {0,...6} {Sunday...Saturday}
> for example between 20:00 and 23:59 set these conditional rules 
> other than this timing set other rules 
> that would be handy like for instance during high traffic hours of the day no background fill should be applied 
> during late night and early morning hours full background fill would be applied 
> and during medium traffic hours (16:00<->20:00) set background fill not to exceed 20sec 
> much regards 
> Faysal Banna



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)