I am following
http://kminder.github.io/knox/2015/11/16/adding-a-service-to-knox.html to
add a weather service to knox.

data/services/weather/0.0.1/rewrite.xml:
<rules>
    <rule dir="IN" name="WEATHER/weather/inbound"
pattern="*://*:*/**/weather/{path=**}?{**}">
        <rewrite template="{$serviceUrl[WEATHER]}/{path=**}?{**}"/>
    </rule>
</rules>

data/services/weather/0.0.1/service.xml:
<service role="WEATHER" name="weather" version="0.0.1">
  <policies>
        <policy role="webappsec"/>
        <policy role="authentication" name="Anonymous"/>
        <policy role="rewrite"/>
        <policy role="authorization"/>
    </policies>
    <routes>
        <route path="/weather/**">
        </route>
    </routes>
</service>

in topology ui.xml:
<service>
        <role>WEATHER</role>
        <url>http://yahoo.com/</url>
 </service>

Accessing https://*knox_load_balancer.com/gateway/ui/weather
<http://knox_load_balancer.com/gateway/ui/weather>* got below output in
gateway-audit.log, I see:

18/09/12 06:15:21
||f7b1ea3a-73ec-464a-87f4-dbb22e22867c|audit|160.34.88.239|WEATHER||||access|uri|/gateway/ui/weather|unavailable|Request
method: GET
18/09/12 06:15:21
||f7b1ea3a-73ec-464a-87f4-dbb22e22867c|audit|160.34.88.239|WEATHER|anonymous|||authentication|uri|/gateway/ui/weather|success|
18/09/12 06:15:21
||f7b1ea3a-73ec-464a-87f4-dbb22e22867c|audit|160.34.88.239|WEATHER|anonymous|||dispatch|uri|http://*knox_load_balancer.com:80
<http://knox_load_balancer.com:80>*/gateway/ui/weather|unavailable|Request
method: GET
18/09/12 06:15:41
||f7b1ea3a-73ec-464a-87f4-dbb22e22867c|audit|160.34.88.239|WEATHER|anonymous|||dispatch|uri|http://*knox_load_balancer.com:80
<http://knox_load_balancer.com:80>*/gateway/ui/weather|failure|
18/09/12 06:15:41
||f7b1ea3a-73ec-464a-87f4-dbb22e22867c|audit|160.34.88.239|WEATHER|anonymous|||access|uri|/gateway/ui/weather|failure|

Looks like url rewrite (replace knox_load_balancer.com:80 with
http://yahoo.com/) does not work. Any idea? Appreciate any clue.

Reply via email to