You can, using scoped rewrite rules and not making them global, I believe this is the JIRA for that https://issues.apache.org/jira/browse/KNOX-711
On Tue, May 22, 2018 at 4:25 PM, Shawn Weeks <[email protected]> wrote: > Does that mean you can't have rules in two different services with the > same pattern? I was expecting rules were executed based on the path of the > service so https://knox/gateway/default/hdfs could have an identical rule > as https://knox/gateway/default/sparkhistory since each service was > monitoring different paths. > > > In this case it wasn't executing the rule from Spark UI instead of HDFS UI > it was just ignoring rule altogether. > > > Thanks > > Shawn Weeks > > ________________________________ > From: Sandeep Mor? <[email protected]> > Sent: Tuesday, May 22, 2018 3:21:37 PM > To: [email protected] > Subject: Re: Other Interesting Rewrite Failures > > This explains it, I was having headache trying to figure out the odd > behavior. > > The problem here is that Knox combines all the rewrites rules into filters > and then it tries to do a best match based on the pattern, in case where > there is no match Knox engine will go for the next best match, This should > be fixed in the upcoming release 1.1.0 by > https://issues.apache.org/jira/browse/KNOX-1157. > > I know you are on 0.12, so applying the patch might be tricky due to > package name changes, you will have to update the patch with the package > names for 0.12.0 (org.apache.hadoop.*) If you decide to go down this patch > I would be eager to know how it went. > > Best, > Sandeep > > On Tue, May 22, 2018 at 4:11 PM, Shawn Weeks <[email protected]> > wrote: > > > Well this is even weirder it turns out the issue is being caused by a > rule > > in the Spark History UI Service. > > > > > > <rule dir="OUT" name="SPARKHISTORYUI/sparkhistory/outbound/static/ > jquery" > > pattern="/static/{jquery=jquery*.min.js}"> > > <rewrite template="{$frontend[url]}/sparkhistory/static/{jquery}"/> > > </rule> > > > > > > This rule appears to be bleeding over into the HDFS UI Service even > though > > service.xml for Spark has all the paths mapped out explicitly. I feel > like > > I'm misunderstanding something about how Knox is supposed to work. > > > > > > Thanks > > > > Shawn Weeks > > > > ________________________________ > > From: Shawn Weeks <[email protected]> > > Sent: Tuesday, May 22, 2018 2:58:56 PM > > To: [email protected] > > Subject: Other Interesting Rewrite Failures > > > > Trying to identify what patch if any resolves the following oddity for > > Knox 0.12. > > > > > > Consider the following rule found in the HDFSUI Service. > > > > > > <rule dir="OUT" name="HDFSUI/content/static" pattern="/static/{**}"> > > <rewrite template="{gateway.url}/hdfs/static/{**}"/> > > </rule> > > > > > > And the following HTML Snippet > > > > <script type="text/javascript" src="/static/jquery-1.10.2. > > min.js"></script> > > <script type="text/javascript" src="/static/bootstrap-3.0.2/ > > js/bootstrap.min.js"></script> > > <script type="text/javascript" src="/static/dust-full-2.0.0. > > min.js"></script> > > <script type="text/javascript" src="/static/dust-helpers-1.1. > > 1.min.js"></script> > > <script type="text/javascript" src="/static/dfs-dust.js"></script> > > <script type="text/javascript" src="/static/rest-csrf.js"></script> > > > > And finally the debug log. > > No rule matching URL: /static/jquery-1.10.2.min.js, direction: OUT > > Rewrote URL: /static/bootstrap-3.0.2/js/bootstrap.min.js, direction: OUT > > via implicit rule: HDFSUI/content/static to URL: > > https://knox.test.org:443/gateway/admin/hdfs/static/ > > bootstrap-3.0.2/js/bootstrap.min.js > > Rewrote URL: /static/dust-full-2.0.0.min.js, direction: OUT via implicit > > rule: HDFSUI/content/static to URL: https://knox.test.org:443/ > > gateway/admin/hdfs/static/dust-full-2.0.0.min.js > > Rewrote URL: /static/dust-helpers-1.1.1.min.js, direction: OUT via > > implicit rule: HDFSUI/content/static to URL: https://knox.test.org:443/ > > gateway/admin/hdfs/static/dust-helpers-1.1.1.min.js > > Rewrote URL: /static/dfs-dust.js, direction: OUT via implicit rule: > > HDFSUI/content/static to URL: https://knox.test.org:443/ > > gateway/admin/hdfs/static/dfs-dust.js > > Rewrote URL: /static/rest-csrf.js, direction: OUT via implicit rule: > > HDFSUI/content/static to URL: https://knox.test.org:443/ > > gateway/admin/hdfs/static/rest-csrf.js > > > > > > After lots of testing I've determined that Knox will not rewrite anything > > like this. > > > > <script type="text/javascript" src="/static/jquery.min.js"></script> > > <a href="/static/jquery.min.js">Hello World </a> > > > > That's oddly specific. Any variation I can try that includes > jquery.min.js > > won't rewrite but jjquery.min.js will. > > > > Thanks > > Shawn Weeks > > > > >
