...
Code Block |
---|
<service role="WEATHER" name="weather" version="0.0.1"> <routes> <route path="/weather/**"/> </routes> </service> |
service.xml file defines the high level URL pattern that will be exposed by the gateway for a service.
...
- $infix - This function is used to used to append custom prefix and postfix
usage - {$infix[<customString>,url,<customString>]}
Code Block <rewrite template="{scheme}://{host}:{port}/{gateway}/{sandbox}/?query={$infix[',url,/sparkhistory/']}"/>
$hostmap
The purpose of the Hostmap provider is to handle situations where host are known by one name within the cluster and another name externally. This frequently occurs when virtual machines are used and in particular when using cloud hosting services. Currently, the Hostmap provider is configured as part of the topology file.
For more information see knox user guide
Rewrite rule example:
Code Block |
---|
<rewrite template="{gateway.url}/hdfs/logs?{scheme}?host={$hostmap(host)}?{port}?{**}"/> |
Topology declaration example
Code Block |
---|
<topology>
<gateway>
...
<provider>
<role>hostmap</role>
<name>static</name>
<enabled>true</enabled>
<param><name>external-host-name</name><value>internal-host-name</value></param>
</provider>
...
</gateway>
...
</topology> |
Rules Filter
Sometimes you want the ability to rewrite the *.js, *.css and other non-html pages. FIlters are a way to rewrite these non-html files. FIlters are based on the content-type of the page.
...