httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 54556] New: New flag to add default rule in rule chain
Date Wed, 13 Feb 2013 12:16:47 GMT

            Bug ID: 54556
           Summary: New flag to add default rule in rule chain
           Product: Apache httpd-2
           Version: 2.4.3
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: mod_rewrite
    Classification: Unclassified

Created attachment 29946
Patch that add CDEF new RewriteRule flag

The CDEF flag marks the rule as the default rule for a rule chain.

If the rule does not match it acts as if it has the CHAIN flag and makes the
engine skip all chained rules.

If the rule matches the result is saved as the default result for the rule
chain and the rule is ignored as if it didn't match, then engine continues
testing rules in the chain. If one of the chain rules matches then the default
is discarded and the matching rule is used. If none of the chained rules
matches, then the default is used.

It converts the rule tagged with CDEF as a sort of RewriteCond that can be used
with more than one rule and provides a default result, but it also actually
prevents the chained rules to be tested if it does not match:

For example:

RewriteRule ^example$    /index.php?action=foo [L,NS,QSA]
RewriteRule ^(login|lostpw|logout|expired)$    /index.php?page=$1 [L,NS,QSA]
RewriteRule ^([a-z]+)$ /index.php?section=$1 [L,NS,QSA]

The first two rules are exceptions to the last one and in a normal setup a uri
that does not match any of this rules will triger a test on every rule. Using
CDEF it can be written that way;

RewriteRule ^([a-z]+)$ /index.php?section=$1 [L,NS,QSA,CDEF]
RewriteRule ^example$    /index.php?action=foo [L,NS,QSA,C]
RewriteRule ^(login|lostpw|logout|expired)$    /index.php?page=$1 [L,NS,QSA]

this way non-matching uri's will only trigger a test on the first rule and all
the other two will be skipped

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message