[ 
https://issues.apache.org/jira/browse/KNOX-797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Larry McCay updated KNOX-797:
-----------------------------
    Description: 
>From Mohammad Islam:

I set  "default.app.topology.name" in gateway-site.xml  to "uber" (my default 
topology name).  
It worked fine if I gave the full URL. The command looks like this "curl  
http://<KNOX_GW_URL>/gateway/uber/webhdfs/v1/?op=GETHOMEDIRECTORY'".
 
However, when I tried with command "curl  
http://<KNOX_GW_URL>/webhdfs/v1/?op=GETHOMEDIRECTORY'". I got the HTTP error 
code 500. I looked into gateway.log file and found quite a few error related to 
rewrite. The exact error messages are shown below:

Error message

{noformat}
2016-11-30 00:39:51,565 ERROR hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(169)) - Failed to rewrite URL: 
http://<KNOX_GW_URL>/webhdfs/v1/?op=GETHOMEDIRECTORY, direction: IN via rule: 
WEBHDFS/webhdfs/inbound/namenode/root, status: FAILURE
2016-11-30 00:39:51,565 ERROR hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(169)) - Failed to rewrite URL: 
http://<KNOX_GW_URL>/webhdfs/v1/?op=GETHOMEDIRECTORY, direction: IN via rule: 
WEBHDFS/webhdfs/inbound/namenode/root, status: FAILURE
{noformat}

After that, I modified the webhdfs/2.4.0/rewrite.xml by rewriting the following 
pattern and it worked for short URL but long URL faces the same issue.

Original: 

{noformat}
<rule dir="IN" name="WEBHDFS/webhdfs/inbound/namenode/root" 
pattern="*://*:*/**/webhdfs/{version}/?{**}">
        <rewrite template="{$serviceUrl[WEBHDFS]}/{version}/?{**}"/>
    </rule>
{noformat}

Modified :

{noformat}
    <rule dir="IN" name="WEBHDFS/webhdfs/inbound/namenode/root" 
pattern="*://*:*/webhdfs/{version}/?{**}">
        <rewrite template="{$serviceUrl[WEBHDFS]}/{version}/?{**}"/>
    </rule>
{noformat}
  

Overall, the rewrite pattern may be the issue. We will need to support for both 
short and long URL. May be, we can add multiple rewrite rules for each route in 
service.xml.
Is there any other cleaner way which may work for all cases such as webhdfs, 
yarn, hive, UIs etc?


  was:
>From Mohammad Islam:

I set  "default.app.topology.name" in gateway-site.xml  to "uber" (my default 
topology name).  
It worked fine if I gave the full URL. The command looks like this "curl  
http://<KNOX_GW_URL>/gateway/uber/webhdfs/v1/?op=GETHOMEDIRECTORY'".
 
However, when I tried with command "curl  
http://<KNOX_GW_URL>/webhdfs/v1/?op=GETHOMEDIRECTORY'". I got the HTTP error 
code 500. I looked into gateway.log file and found quite a few error related to 
rewrite. The exact error messages are shown below:

Error message

2016-11-30 00:39:51,565 ERROR hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(169)) - Failed to rewrite URL: 
http://<KNOX_GW_URL>/webhdfs/v1/?op=GETHOMEDIRECTORY, direction: IN via rule: 
WEBHDFS/webhdfs/inbound/namenode/root, status: FAILURE
2016-11-30 00:39:51,565 ERROR hadoop.gateway 
(UrlRewriteProcessor.java:rewrite(169)) - Failed to rewrite URL: 
http://<KNOX_GW_URL>/webhdfs/v1/?op=GETHOMEDIRECTORY, direction: IN via rule: 
WEBHDFS/webhdfs/inbound/namenode/root, status: FAILURE


After that, I modified the webhdfs/2.4.0/rewrite.xml by rewriting the following 
pattern and it worked for short URL but long URL faces the same issue.

Original: 

{noformat}
<rule dir="IN" name="WEBHDFS/webhdfs/inbound/namenode/root" 
pattern="*://*:*/**/webhdfs/{version}/?{**}">
        <rewrite template="{$serviceUrl[WEBHDFS]}/{version}/?{**}"/>
    </rule>
{noformat}

Modified :

{noformat}
    <rule dir="IN" name="WEBHDFS/webhdfs/inbound/namenode/root" 
pattern="*://*:*/webhdfs/{version}/?{**}">
        <rewrite template="{$serviceUrl[WEBHDFS]}/{version}/?{**}"/>
    </rule>
{noformat}
  

Overall, the rewrite pattern may be the issue. We will need to support for both 
short and long URL. May be, we can add multiple rewrite rules for each route in 
service.xml.
Is there any other cleaner way which may work for all cases such as webhdfs, 
yarn, hive, UIs etc?



> Default Topology Feature Not Working
> ------------------------------------
>
>                 Key: KNOX-797
>                 URL: https://issues.apache.org/jira/browse/KNOX-797
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Server
>            Reporter: Larry McCay
>            Assignee: Larry McCay
>             Fix For: 0.11.0
>
>
> From Mohammad Islam:
> I set  "default.app.topology.name" in gateway-site.xml  to "uber" (my default 
> topology name).  
> It worked fine if I gave the full URL. The command looks like this "curl  
> http://<KNOX_GW_URL>/gateway/uber/webhdfs/v1/?op=GETHOMEDIRECTORY'".
>  
> However, when I tried with command "curl  
> http://<KNOX_GW_URL>/webhdfs/v1/?op=GETHOMEDIRECTORY'". I got the HTTP error 
> code 500. I looked into gateway.log file and found quite a few error related 
> to rewrite. The exact error messages are shown below:
> Error message
> {noformat}
> 2016-11-30 00:39:51,565 ERROR hadoop.gateway 
> (UrlRewriteProcessor.java:rewrite(169)) - Failed to rewrite URL: 
> http://<KNOX_GW_URL>/webhdfs/v1/?op=GETHOMEDIRECTORY, direction: IN via rule: 
> WEBHDFS/webhdfs/inbound/namenode/root, status: FAILURE
> 2016-11-30 00:39:51,565 ERROR hadoop.gateway 
> (UrlRewriteProcessor.java:rewrite(169)) - Failed to rewrite URL: 
> http://<KNOX_GW_URL>/webhdfs/v1/?op=GETHOMEDIRECTORY, direction: IN via rule: 
> WEBHDFS/webhdfs/inbound/namenode/root, status: FAILURE
> {noformat}
> After that, I modified the webhdfs/2.4.0/rewrite.xml by rewriting the 
> following pattern and it worked for short URL but long URL faces the same 
> issue.
> Original: 
> {noformat}
> <rule dir="IN" name="WEBHDFS/webhdfs/inbound/namenode/root" 
> pattern="*://*:*/**/webhdfs/{version}/?{**}">
>         <rewrite template="{$serviceUrl[WEBHDFS]}/{version}/?{**}"/>
>     </rule>
> {noformat}
> Modified :
> {noformat}
>     <rule dir="IN" name="WEBHDFS/webhdfs/inbound/namenode/root" 
> pattern="*://*:*/webhdfs/{version}/?{**}">
>         <rewrite template="{$serviceUrl[WEBHDFS]}/{version}/?{**}"/>
>     </rule>
> {noformat}
>   
> Overall, the rewrite pattern may be the issue. We will need to support for 
> both short and long URL. May be, we can add multiple rewrite rules for each 
> route in service.xml.
> Is there any other cleaner way which may work for all cases such as webhdfs, 
> yarn, hive, UIs etc?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to