You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Gancho Tenev (JIRA)" <ji...@apache.org> on 2016/09/02 17:52:21 UTC

[jira] [Comment Edited] (TS-4809) [header_rewrite] check to make sure "hook" conditions are first in the rule set

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

Gancho Tenev edited comment on TS-4809 at 9/2/16 5:51 PM:
----------------------------------------------------------

Provided a patch which would error like this:

{code}
20160901.23h17m13s [header_rewrite] cond %{REMAP_PSEUDO_HOOK} at hdrs.config:2 should be the first hook condition in the rule set and each rule set should contain only one hook condition
{code}

In the following 2 use-cases:

* The hook condition is not the first in the rule set. {code}
$ sudo cat etc/trafficserver/hdrs.config
cond %{TRUE}
cond %{REMAP_PSEUDO_HOOK}
   set-header Some-Header "some value"
{code}

* There are 2 hook conditions in the same rule set. {code}
$ sudo cat etc/trafficserver/hdrs.config
cond %{REMAP_PSEUDO_HOOK}
cond %{TRUE}
cond %{SEND_RESPONSE_HDR_HOOK}
   set-header Some-Header "some value"
{code}

Also added line numbers to the error messages in {{RuleSet::add_condition()}} and {{RuleSet::add_operator()}}.




was (Author: gancho):
Provided a patch which would error like this:

{code}
20160901.23h17m13s [header_rewrite] cond %{REMAP_PSEUDO_HOOK} at hdrs.config:2 should be the first hook condition in the rule set and each rule set should contain only one hook condition
{code}

In the following 2 use-cases:

* The hook condition is not the first in the rule set. {code}
$ sudo cat etc/trafficserver/hdrs.config
cond %{TRUE}
cond %{REMAP_PSEUDO_HOOK}
   set-header Some-Header "some value"
{code}

* There are 2 hook conditions in the same rule set. {code}
$ sudo cat etc/trafficserver/hdrs.config
cond %{REMAP_PSEUDO_HOOK}
cond %{TRUE}
cond %{SEND_RESPONSE_HDR_HOOK}
   set-header Some-Header "some value"
{code}

Also added a line numbers to the error messages in {{RuleSet::add_condition()}} and {{RuleSet::add_operator()}}.



> [header_rewrite] check to make sure "hook" conditions are first in the rule set 
> --------------------------------------------------------------------------------
>
>                 Key: TS-4809
>                 URL: https://issues.apache.org/jira/browse/TS-4809
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: Plugins
>            Reporter: Gancho Tenev
>            Assignee: Gancho Tenev
>             Fix For: 7.0.0
>
>
> The following configuration
> {code}
> $ cat etc/trafficserver/remap.config
> map http://example.com http://127.0.0.1:8888 \
>     @plugin=header_rewrite.so @pparam=hdrs.config
> $ cat etc/trafficserver/hdrs.config
> cond %{TRUE}
> cond %{REMAP_PSEUDO_HOOK}
>    set-header Some-Header "some value"
> {code}
> Triggers the following error which does not show what and where the problem is:
> {code}
> 20160901.23h17m13s [header_rewrite] Unknown condition: REMAP_PSEUDO_HOOK
> {code}
> I would like to add a check which will prevent the above error and print another error clarifying where and what the problem is, for instance:
> {code}
> 20160901.23h17m13s [header_rewrite] cond %{REMAP_PSEUDO_HOOK} should come first in the rule set at hdrs.config:2
> {code}



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