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 <swe...@weeksconsulting.us>
Sent: Tuesday, May 22, 2018 2:58:56 PM
To: dev@knox.apache.org
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

Reply via email to