You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@knox.apache.org by Rajat Goel <ra...@guavus.com> on 2018/07/17 17:02:20 UTC
Issue while accessing URIs containing '%'
Hi,
I am trying to integrate Grafana UI with Knox. Grafana UI main page internally sends a request URI ‘https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514<https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%25&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514>’ to Knox. Notice here that there is a query param: ‘hostname=%’.
In the logs I see that Knox rewrites the url using rewrite rule but there are exceptions:
2018-07-17 13:01:21,332 DEBUG hadoop.gateway (UrlRewriteProcessor.java:rewrite(166)) - Rewrote
URL: https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514<https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%25&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514>, direction: IN via explicit rule: GRAFANAUI/grafana/inbound/queryvariable to URL: http://mst-01.mydomain.com:3000/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%25&instanceId=&appId=ams-hbase&startTime=1531806914&endTime=1531828514
2018-07-17 13:01:21,335 ERROR hadoop.gateway (AbstractGatewayFilter.java:doFilter(69)) - Failed to execute filter: java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern
java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern
at java.net.URLDecoder.decode(URLDecoder.java:187)
at org.apache.hadoop.gateway.util.HttpUtils.splitQuery(HttpUtils.java:46)
at org.apache.hadoop.gateway.identityasserter.common.filter.IdentityAsserterHttpServletRequestWrapper.getParams(IdentityAsserterHttpServletRequestWrapper.java:135)
at org.apache.hadoop.gateway.identityasserter.common.filter.IdentityAsserterHttpServletRequestWrapper.getParams(IdentityAsserterHttpServletRequestWrapper.java:154)
at org.apache.hadoop.gateway.identityasserter.common.filter.IdentityAsserterHttpServletRequestWrapper.getQueryString(IdentityAsserterHttpServletRequestWrapper.java:162)
at org.apache.hadoop.gateway.dispatch.AbstractGatewayDispatch.getDispatchUrl(AbstractGatewayDispatch.java:83)
at org.apache.hadoop.gateway.dispatch.GatewayDispatchFilter$GetAdapter.doMethod(GatewayDispatchFilter.java:132)
at org.apache.hadoop.gateway.dispatch.GatewayDispatchFilter.doFilter(GatewayDispatchFilter.java:115)
at org.apache.hadoop.gateway.filter.AbstractGatewayFilter.doFilter(AbstractGatewayFilter.java:61)
My rewrite rule is very simple of the form:
<rule dir="IN" name=" GRAFANAUI/grafana/inbound/queryvariable" pattern="*://*:*/**/grafana/{**}?{**}">
<rewrite template="{$serviceUrl[GRAFANA]}/{**}?{**}"/>
</rule>
I am using PassAllHeadersDispatch. Knox rewrires the URL with query param ‘hostname=%25’.
How can I fix this ?
Thanks & Regards,
Rajat
Re: Issue while accessing URIs containing '%'
Posted by Rajat Goel <ra...@guavus.com>.
Thanks Sandeep. I will try this out.
From: Sandeep Moré <mo...@gmail.com>
Reply-To: "user@knox.apache.org" <us...@knox.apache.org>
Date: Wednesday, 18 July 2018 at 9:43 PM
To: "user@knox.apache.org" <us...@knox.apache.org>
Subject: Re: Issue while accessing URIs containing '%'
Hello Rajat,
I am not well aware of Grafana UI so I do not know how the URL should look like so I am assuming you need % to be in the url right ?
Can you try using the following dispatches
1. PassAllHeadersNoEncodingDispatch
2. URLDecodingDispatch
Hopefully one of them should work.
Best,
Sandeep
On Tue, Jul 17, 2018 at 1:02 PM Rajat Goel <ra...@guavus.com>> wrote:
Hi,
I am trying to integrate Grafana UI with Knox. Grafana UI main page internally sends a request URI ‘https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514<https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%25&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514>’ to Knox. Notice here that there is a query param: ‘hostname=%’.
In the logs I see that Knox rewrites the url using rewrite rule but there are exceptions:
2018-07-17 13:01:21,332 DEBUG hadoop.gateway (UrlRewriteProcessor.java:rewrite(166)) - Rewrote
URL: https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514<https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%25&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514>, direction: IN via explicit rule: GRAFANAUI/grafana/inbound/queryvariable to URL: http://mst-01.mydomain.com:3000/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%25&instanceId=&appId=ams-hbase&startTime=1531806914&endTime=1531828514
2018-07-17 13:01:21,335 ERROR hadoop.gateway (AbstractGatewayFilter.java:doFilter(69)) - Failed to execute filter: java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern
java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern
at java.net.URLDecoder.decode(URLDecoder.java:187)
at org.apache.hadoop.gateway.util.HttpUtils.splitQuery(HttpUtils.java:46)
at org.apache.hadoop.gateway.identityasserter.common.filter.IdentityAsserterHttpServletRequestWrapper.getParams(IdentityAsserterHttpServletRequestWrapper.java:135)
at org.apache.hadoop.gateway.identityasserter.common.filter.IdentityAsserterHttpServletRequestWrapper.getParams(IdentityAsserterHttpServletRequestWrapper.java:154)
at org.apache.hadoop.gateway.identityasserter.common.filter.IdentityAsserterHttpServletRequestWrapper.getQueryString(IdentityAsserterHttpServletRequestWrapper.java:162)
at org.apache.hadoop.gateway.dispatch.AbstractGatewayDispatch.getDispatchUrl(AbstractGatewayDispatch.java:83)
at org.apache.hadoop.gateway.dispatch.GatewayDispatchFilter$GetAdapter.doMethod(GatewayDispatchFilter.java:132)
at org.apache.hadoop.gateway.dispatch.GatewayDispatchFilter.doFilter(GatewayDispatchFilter.java:115)
at org.apache.hadoop.gateway.filter.AbstractGatewayFilter.doFilter(AbstractGatewayFilter.java:61)
My rewrite rule is very simple of the form:
<rule dir="IN" name=" GRAFANAUI/grafana/inbound/queryvariable" pattern="*://*:*/**/grafana/{**}?{**}">
<rewrite template="{$serviceUrl[GRAFANA]}/{**}?{**}"/>
</rule>
I am using PassAllHeadersDispatch. Knox rewrires the URL with query param ‘hostname=%25’.
How can I fix this ?
Thanks & Regards,
Rajat
Re: Issue while accessing URIs containing '%'
Posted by Sandeep Moré <mo...@gmail.com>.
Hello Rajat,
I am not well aware of Grafana UI so I do not know how the URL should look
like so I am assuming you need % to be in the url right ?
Can you try using the following dispatches
1. *PassAllHeadersNoEncodingDispatch*
2. *URLDecodingDispatch*
Hopefully one of them should work.
Best,
Sandeep
On Tue, Jul 17, 2018 at 1:02 PM Rajat Goel <ra...@guavus.com> wrote:
> Hi,
>
>
>
> I am trying to integrate Grafana UI with Knox. Grafana UI main page
> internally sends a request URI ‘
> https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514’
> to Knox. Notice here that there is a query param: ‘hostname=%’.
>
>
>
> In the logs I see that Knox rewrites the url using rewrite rule but there
> are exceptions:
>
>
>
> *2018-07-17 13:01:21,332 DEBUG hadoop.gateway
> (UrlRewriteProcessor.java:rewrite(166)) - Rewrote *
>
> *URL:* *https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514
> <https://192.168.134.225:8443/gateway/default/grafana/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%25&appId=ams-hbase&instanceId=&startTime=1531806914&endTime=1531828514>,
> direction: IN via explicit rule: GRAFANAUI/grafana/inbound/queryvariable to
> URL:* *http://mst-01.mydomain.com:3000/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%25&instanceId=&appId=ams-hbase&startTime=1531806914&endTime=1531828514
> <http://mst-01.mydomain.com:3000/api/datasources/proxy/1/ws/v1/timeline/metrics?metricNames=regionserver.Server.regionCount._max&hostname=%25&instanceId=&appId=ams-hbase&startTime=1531806914&endTime=1531828514>*
>
> *2018-07-17 13:01:21,335 ERROR hadoop.gateway
> (AbstractGatewayFilter.java:doFilter(69)) - Failed to execute filter:
> java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape
> (%) pattern*
>
> *java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing
> escape (%) pattern*
>
> *at java.net.URLDecoder.decode(URLDecoder.java:187)*
>
> *at org.apache.hadoop.gateway.util.HttpUtils.splitQuery(HttpUtils.java:46)*
>
> *at
> org.apache.hadoop.gateway.identityasserter.common.filter.IdentityAsserterHttpServletRequestWrapper.getParams(IdentityAsserterHttpServletRequestWrapper.java:135)*
>
> *at
> org.apache.hadoop.gateway.identityasserter.common.filter.IdentityAsserterHttpServletRequestWrapper.getParams(IdentityAsserterHttpServletRequestWrapper.java:154)*
>
> *at
> org.apache.hadoop.gateway.identityasserter.common.filter.IdentityAsserterHttpServletRequestWrapper.getQueryString(IdentityAsserterHttpServletRequestWrapper.java:162)*
>
> *at
> org.apache.hadoop.gateway.dispatch.AbstractGatewayDispatch.getDispatchUrl(AbstractGatewayDispatch.java:83)*
>
> *at
> org.apache.hadoop.gateway.dispatch.GatewayDispatchFilter$GetAdapter.doMethod(GatewayDispatchFilter.java:132)*
>
> *at
> org.apache.hadoop.gateway.dispatch.GatewayDispatchFilter.doFilter(GatewayDispatchFilter.java:115)*
>
> *at
> org.apache.hadoop.gateway.filter.AbstractGatewayFilter.doFilter(AbstractGatewayFilter.java:61)*
>
>
>
> My rewrite rule is very simple of the form:
>
> *<rule dir="IN" name=" GRAFANAUI/grafana/inbound/queryvariable"
> pattern="*://*:*/**/grafana/{**}?{**}">*
>
> * <rewrite template="{$serviceUrl[GRAFANA]}/{**}?{**}"/>*
>
> * </rule>*
>
>
>
> I am using PassAllHeadersDispatch. Knox rewrires the URL with query param
> ‘hostname=%25’.
>
>
>
> How can I fix this ?
>
>
>
> Thanks & Regards,
>
> Rajat
>