Hey Adam,
You are very close.  I think I’ll take this opportunity and possibly parts of 
your example (if you don’t mind) to beef up the dev-guide and of course help 
you along the way.  The whole URL rewrite aspect is currently a large black 
hole.  Can you show me the curl command you use “inside of the gateway” for 
your service that works?  Username, passwords, hostnames and ports scrubbed to 
protect he innocent of course. ;)  I’m most interested in the final URL 
required.
Kevin.




On 11/16/15, 9:38 AM, "Adam Davidson" <[email protected]> 
wrote:

>Hi,
>
>As part of some client work I'm trying to add a service to a Knox topology
>in the Hortonworks HDP 2.3.1 sandbox; this includes Knox 0.6.0. My
>understanding is that I simply need to add the <service> to the topology
>XML and then create directories under <knox home>/data/services with new
>service and rewrite XML files.
>
>In this test case the REST service is a similar demo app running on port
>8095. I've created the service and rewrite XMLs as before yet the gateway
>is throwing a 404 when I try and access the API from outside the sandbox.
>The usual calls to WebHDFS through the gateway still work.  My demo REST
>service is running and can be accessed through curl on the inside of the
>gateway.
>
>I've added the following to the default.xml topology (and also
>knox-sample.xml, another topology in the HDP sandbox)
><service>
>        <role>HELLO</role>
>        <url>http://sandbox.hortonworks.com:8095/greeting</url>
></service>
>
>This is my service.xml in data/services/hello/0.0.1
><service role="HELLO" name="hello" version="0.0.1">
>    <routes>
>        <route path="/greeting/v1/?**">
>            <rewrite apply="HELLO/greeting/inbound/root" to="request.url"/>
>        </route>
>    </routes>
></service>
>
>And finally this is my rewrite.xml
><rules>
>    <rule dir="IN" name="HELLO/greeting/inbound/root"
>pattern="*://*:*/**/greeting/v1/?{**}">
>        <rewrite template="{$serviceUrl[HELLO]}?/v1/{**}"/>
>    </rule>
></rules>
>
>Am I missing anything in terms of configuration? I must confess I'm not
>sure what's going on in rewrite.xml and struggle to get much out of the
>documentation.
>
>Best Regards,
>Adam
>
>-- 
> 
>
>*NOTICE AND DISCLAIMER*
>
>This email (including attachments) is confidential. If you are not the 
>intended recipient, notify the sender immediately, delete this email from 
>your system and do not disclose or use for any purpose.
>
>Business Address: Eagle House, 163 City Road, London, EC1V 1NR. United 
>Kingdom
>Registered Office: Finsgate, 5-7 Cranwood Street, London, EC1V 9EE. United 
>Kingdom
>Big Data Partnership Limited is a company registered in England & Wales 
>with Company No 7904824

Reply via email to