Hi all,

I'm working to add support for Solr's API to Apache Knox.  To do so, I've 
created a service.xml and rewrite.xml, and deployed to 
${GATEWAY_HOME}/data/conf/services/solr/5.5.0

See the files here: 
https://github.com/mcparlandjcgi/knox/tree/KNOX-528/gateway-service-definitions/src/main/resources/services/solr/5.5.0
I also wrote a test to check that the re-write rules work as expected (see 
https://github.com/mcparlandjcgi/knox/blob/KNOX-528/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteProcessorTest.java#L281)

I have defined the Solr service in my sandbox topology like so;

    <service>
        <role>SOLR</role>
        <url>http://sandbox.hortonworks.com:8983/solr</url>
    </service>

However when I attempt to execute a Solr Query via Knox, I find that the rule 
isn't applied and indeed, no matching rule is found at all.

2016-11-18 12:04:23,221 TRACE gateway.access (AccessHandler.java:log(49)) - 
|||158.234.220.6|GET|/gateway/sandbox/solr/KnoxSolrIntegration/select?q=*.*&wt=json&indent=true|-1|200|0|6
2016-11-18 12:04:23,231 TRACE http.request 
(TraceRequest.java:traceRequestDetails(66)) - 
||82e1c7f7-4eb5-499d-8f29-7602652079f1|Request=GET 
/gateway/sandbox/solr/KnoxSolrIntegration/select?q=*.*&wt=json&indent=true
        Header[User-Agent]=curl/7.47.0
        Header[Authorization]=Basic Z3Vlc3Q6Z3Vlc3QtcGFzc3dvcmQ=
        Header[Accept]=*/*
        Header[Host]=hdp24sandbox.ukwest.cloudapp.azure.com:8443
2016-11-18 12:04:23,786 DEBUG hadoop.gateway (GatewayFilter.java:doFilter(116)) 
- Received request: GET /solr/KnoxSolrIntegration/select
2016-11-18 12:04:23,888 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: 
hdp24sandbox:8443, direction: IN
2016-11-18 12:04:23,889 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: 8443, 
direction: IN
2016-11-18 12:04:23,889 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: https, 
direction: IN
2016-11-18 12:04:25,052 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: 
https://hdp24sandbox.ukwest.cloudapp.azure.com:8443/gateway/sandbox/solr/KnoxSolrIntegration/select?q=*.*&wt=json&indent=true,
 direction: IN
2016-11-18 12:04:25,062 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: 158.234.220.6, 
direction: IN
2016-11-18 12:04:25,062 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: https, 
direction: IN
2016-11-18 12:04:25,063 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: 8443, 
direction: IN
2016-11-18 12:04:25,063 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: 
hdp24sandbox:8443, direction: IN
2016-11-18 12:04:25,063 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: hdp24sandbox, 
direction: IN
2016-11-18 12:04:25,063 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: 
/gateway/sandbox, direction: IN
2016-11-18 12:04:25,064 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: curl/7.47.0, 
direction: IN
2016-11-18 12:04:25,069 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: Basic 
Z3Vlc3Q6Z3Vlc3QtcGFzc3dvcmQ=, direction: IN
2016-11-18 12:04:25,070 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: */*, direction: 
IN
2016-11-18 12:04:25,070 TRACE hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(177)) - No rule matching URL: 
hdp24sandbox:8443, direction: IN
2016-11-18 12:04:25,072 DEBUG hadoop.gateway 
(DefaultDispatch.java:executeOutboundRequest(120)) - Dispatch request: GET 
https://hdp24sandbox:8443/gateway/sandbox/solr/KnoxSolrIntegration/select?q=*.*&wt=json&indent=true

What I expect at the end is the Dispatch request to go to

http://sandbox.hortonworks.com:8983/solr/KnoxSolrIntegration/select?q=*.*&wt=json&indent=true

Is there a missing relationship or problem in my service/rules which prevents 
the rule being matched with the request URL?

Thanks,

John McParland MIET CEng | System Architect, ODSC
Health Local and Scotland | CGI
CGI Ltd (UK)
Second Floor, Inovo Building, 121 George St, Glasgow, UK, G1 1RD
M: +44 7920 183 019
[email protected] | www.cgi-group.co.uk

CGI IT UK Limited. A CGI Group Inc. Company
Registered Office: 250 Brook Drive, Green Park, Reading RG2 6UA,
United Kingdom. Registered in England & Wales - Number 947968

CONFIDENTIALITY NOTICE: Proprietary/Confidential Information belonging to CGI 
Group Inc. and its affiliates may be contained in this message. If you are not 
a recipient indicated or intended in this message (or responsible for delivery 
of this message to such person), or you think for any reason that this message 
may have been addressed to you in error, you may not use or copy or deliver 
this message to anyone else. In such case, you should destroy this message and 
are asked to notify the sender by reply e-mail.

Reply via email to