[ https://issues.apache.org/jira/browse/KNOX-1157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16477904#comment-16477904 ]
ASF subversion and git services commented on KNOX-1157: ------------------------------------------------------- Commit a1640b99e667687f370c4760e37959d99cc6a578 in knox's branch refs/heads/master from Wei Han [ https://git-wip-us.apache.org/repos/asf?p=knox.git;h=a1640b9 ] KNOX-1157 - Scoped rewrite rules are treated as global rules in some cases (Wei Han via Phil Zampino) > Scoped rewrite rules are treated as global rules in some cases > -------------------------------------------------------------- > > Key: KNOX-1157 > URL: https://issues.apache.org/jira/browse/KNOX-1157 > Project: Apache Knox > Issue Type: Bug > Reporter: Wei Han > Assignee: Wei Han > Priority: Minor > Fix For: 1.1.0 > > Attachments: NewScopedMatcher.patch > > > https://issues.apache.org/jira/browse/KNOX-711 introduced the concept of > 'scope' for rewrite rules. A rewrite rule can be applied to an input url only > if they share the same scope, unless the rule is explicitly defined as > 'global' rules. > However given the following rewrite.xml, and input url "/foo/bar" with role > service-1, the second rule(service-2) will win because the second rule is > more specific, even the scope is different from the input url. > <rule name="service-1/test-rule-8" dir="OUT" pattern="/foo/{**}"> > <rewrite template="/foo/service-1" /> > </rule> > <rule name="service-2/test-rule-9" dir="OUT" pattern="/foo/bar"> > <rewrite template="/foo/service-2" /> > </rule> > The root cause is the templates for these two rules are different, so in > ScopedMatcher.java(https://github.com/apache/knox/commit/286e02a44dfb5f9ee101007b46bcb8ee47fa62d7#diff-6cffc9c391024e27c73a85ba8e736e60R118), > we don't create a separate matcher and the two rules share the same matcher > object. > My proposal is to change the implementation to create a brand new matcher for > each scope, and store them in a map keyed by scope name. -- This message was sent by Atlassian JIRA (v7.6.3#76005)