I can’t do that yet because of our version of Knox (0.6.0), but after we upgrade to 1.1 or after I will try it.
Thanks! Billy Watson From: Sandeep Moré <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Thursday, July 26, 2018 at 1:52 PM To: "[email protected]" <[email protected]> Subject: Re: Complicated Javascript Rewrite Hello Billy, You can use the variable $infix<https://cwiki.apache.org/confluence/display/KNOX/2017/08/14/Understanding+Rewrite+Rules+for+Apache+Knox#UnderstandingRewriteRulesforApacheKnox-$infix> instead of $frontend. for e.g. {$infix[return",url,jobs"]} Best, Sandeep On Thu, Jul 26, 2018 at 12:10 PM Watson, Billy <[email protected]<mailto:[email protected]>> wrote: Hello, In trying to rewrite some javascript, there are multiple places where a path is used as a raw string and as a value somewhere else in the code. For instance, key: "searchPath", get: function() { return "jobs" } And: type: "jobs" I want to replace the first “jobs”, but not the second one. The best I could come up with was this: <rule dir="OUT" name="SERVICE/service/outbound/searchpath/jobs"> <match pattern="return"jobs" /> <rewrite template="return"{$frontend[path]}/jobs"/> </rule> <filter name="SERVICE/service/outbound/href"> <content type="application/javascript"> <apply path="return"jobs" rule="SERVICE/service/outbound/searchpath/jobs" /> This results in: return "{$frontend[path]}/jobs" The {$frontend[path]} shows up raw instead of being replaced. If I put that at the beginning of the template string, it gets replaced, but not if I put it where I need it. How can I work around this or should I look at contributing some code back to knox to change this behavior? By the way, I hardcoded /gateway/{topology}/service into the rewrite template, which of course answers my own question. But I’m looking for a better workaround in case I need to use this service across topologies. Thanks, Billy Watson Lead Platform Engineer, Parks Data Platform Walt Disney Attractions Technology 7055 S Kirkman Rd, 225B, Orlando, FL 32819
