[
https://issues.apache.org/jira/browse/KNOX-2531?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Iain Buclaw updated KNOX-2531:
------------------------------
Description:
I think the fix is similar to KNOX-2456.
The Kill Application button
!image-2021-01-21-12-25-56-040.png!
Ends up being rewritten as:
[https://host:443/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state|https://host/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state]
Debug logs show:
{code:java}
2021-01-21 10:20:05,069 DEBUG knox.gateway
(UrlRewriteProcessor.java:rewrite(164)) - Rewrote URL:
/ws/v1/cluster/apps/application, direction: OUT via explicit rule:
YARNUI/yarn/outbound/apps/cluster1 to URL:
https://host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application
2021-01-21 10:20:05,070 DEBUG knox.gateway
(UrlRewriteProcessor.java:rewrite(164)) - Rewrote URL:
/ws/v1/cluster/apps/application_1611223368889_0003/state', contentType:
'application/json', data: '{"state":"KILLED"}', dataType: 'json'
}).done(function(data){ setTimeout(function(){ location.href =
'/cluster/app/application_1611223368889_0003'; }, 1000);
}).fail(function(data){ console.log(data); }); }}, direction: OUT via explicit
rule: YARNUI/yarn/outbound/ws1 to URL:
https://host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state',
contentType: 'application/json', data: '{"state":"KILLED"}', dataType: 'json'
}).done(function(data){ setTimeout(function(){ location.href =
'/cluster/app/application_1611223368889_0003'; }, 1000);
}).fail(function(data){ console.log(data); }); }}
2021-01-21 11:27:02,958 DEBUG knox.gateway
(UrlRewriteProcessor.java:rewrite(164)) - Rewrote URL:
/cluster/app/application, direction: OUT via explicit rule:
YARNUI/yarn/outbound/cluster/app/application to URL:
https://host:443/gateway/proxy/yarn/cluster/app/application
2021-01-21 10:20:05,071 TRACE knox.gateway
(UrlRewriteProcessor.java:rewrite(167)) - Failed to rewrite URL:
https://host:443/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state,
direction: OUT via rule: YARNUI/yarn/outbound/node2, status: FAILURE
{code}
This suggests that the original URL path is rewritten twice.
I suspect it is these two filter rules that's doing the double rewrite.
{code:java}
<filter name="YARNUI/yarn/outbound/filter/cluster">
<content type="*/html">
<apply path="(https?://[^/':,]+:[\d]+)?/ws/v1/cluster/apps/application"
rule="YARNUI/yarn/outbound/apps/cluster1"/>
<apply path="/ws/v1/.*" rule="YARNUI/yarn/outbound/ws1"/>
<!-- snip -->
</content>
</filter>
{code}
Originally, it is: /ws/v1/cluster/apps/application_1611223368889_0003/state
The first apply path rule matches and rewrites it to:
[https://host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state|https://host/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state]
The second apply rule also matches and rewrites it to:
[https://host:443/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state|https://host/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state]
The broken link is then passed through the rewrite rule processor again,
doesn't match anything, so a FAILURE logline is written.
The final output of the filtered html is:
was:
I think the fix is similar to KNOX-2456.
The Kill Application button
!image-2021-01-21-12-25-56-040.png!
Ends up being rewritten as:
[https://host:443/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state|https://host/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state]
Debug logs show:
{code:java}
2021-01-21 10:20:05,069 DEBUG knox.gateway
(UrlRewriteProcessor.java:rewrite(164)) - Rewrote URL:
/ws/v1/cluster/apps/application, direction: OUT via explicit rule:
YARNUI/yarn/outbound/apps/cluster1 to URL:
https://host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application
2021-01-21 10:20:05,070 DEBUG knox.gateway
(UrlRewriteProcessor.java:rewrite(164)) - Rewrote URL:
/ws/v1/cluster/apps/application_1611223368889_0003/state', contentType:
'application/json', data: '{"state":"KILLED"}', dataType: 'json'
}).done(function(data){ setTimeout(function(){ location.href =
'/cluster/app/application_1611223368889_0003'; }, 1000);
}).fail(function(data){ console.log(data); }); }}, direction: OUT via explicit
rule: YARNUI/yarn/outbound/ws1 to URL:
https://host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state',
contentType: 'application/json', data: '{"state":"KILLED"}', dataType: 'json'
}).done(function(data){ setTimeout(function(){ location.href =
'/cluster/app/application_1611223368889_0003'; }, 1000);
}).fail(function(data){ console.log(data); }); }}
2021-01-21 11:27:02,958 DEBUG knox.gateway
(UrlRewriteProcessor.java:rewrite(164)) - Rewrote URL:
/cluster/app/application, direction: OUT via explicit rule:
YARNUI/yarn/outbound/cluster/app/application to URL:
https://host:443/gateway/proxy/yarn/cluster/app/application
2021-01-21 10:20:05,071 TRACE knox.gateway
(UrlRewriteProcessor.java:rewrite(167)) - Failed to rewrite URL:
https://host:443/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state,
direction: OUT via rule: YARNUI/yarn/outbound/node2, status: FAILURE
{code}
This suggests that the original URL path is rewritten twice.
I suspect it is these two filter rules that's doing the double rewrite.
{code:java}
<filter name="YARNUI/yarn/outbound/filter/cluster">
<content type="*/html">
<apply path="(https?://[^/':,]+:[\d]+)?/ws/v1/cluster/apps/application"
rule="YARNUI/yarn/outbound/apps/cluster1"/>
<apply path="/ws/v1/.*" rule="YARNUI/yarn/outbound/ws1"/>
<!-- snip -->
</content>
</filter>
{code}
Originally, it is: /ws/v1/cluster/apps/application_1611223368889_0003/state
The first apply path rule matches and rewrites it to:
[https://host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state|https://host/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state]
The second apply rule also matches and rewrites it to:
[https://host:443/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state|https://host/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state]
The broken link is then passed through the rewrite rule processor again,
doesn't match anything, so a FAILURE logline is written.
> Kill Application button in YARN does not work through KNOX
> ----------------------------------------------------------
>
> Key: KNOX-2531
> URL: https://issues.apache.org/jira/browse/KNOX-2531
> Project: Apache Knox
> Issue Type: Bug
> Affects Versions: 1.4.0
> Reporter: Iain Buclaw
> Priority: Major
> Attachments: image-2021-01-21-12-25-56-040.png
>
>
> I think the fix is similar to KNOX-2456.
> The Kill Application button
> !image-2021-01-21-12-25-56-040.png!
> Ends up being rewritten as:
> [https://host:443/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state|https://host/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state]
> Debug logs show:
> {code:java}
> 2021-01-21 10:20:05,069 DEBUG knox.gateway
> (UrlRewriteProcessor.java:rewrite(164)) - Rewrote URL:
> /ws/v1/cluster/apps/application, direction: OUT via explicit rule:
> YARNUI/yarn/outbound/apps/cluster1 to URL:
> https://host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application
> 2021-01-21 10:20:05,070 DEBUG knox.gateway
> (UrlRewriteProcessor.java:rewrite(164)) - Rewrote URL:
> /ws/v1/cluster/apps/application_1611223368889_0003/state', contentType:
> 'application/json', data: '{"state":"KILLED"}', dataType: 'json'
> }).done(function(data){ setTimeout(function(){ location.href =
> '/cluster/app/application_1611223368889_0003'; }, 1000);
> }).fail(function(data){ console.log(data); }); }}, direction: OUT via
> explicit rule: YARNUI/yarn/outbound/ws1 to URL:
> https://host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state',
> contentType: 'application/json', data: '{"state":"KILLED"}', dataType:
> 'json' }).done(function(data){ setTimeout(function(){ location.href =
> '/cluster/app/application_1611223368889_0003'; }, 1000);
> }).fail(function(data){ console.log(data); }); }}
> 2021-01-21 11:27:02,958 DEBUG knox.gateway
> (UrlRewriteProcessor.java:rewrite(164)) - Rewrote URL:
> /cluster/app/application, direction: OUT via explicit rule:
> YARNUI/yarn/outbound/cluster/app/application to URL:
> https://host:443/gateway/proxy/yarn/cluster/app/application
> 2021-01-21 10:20:05,071 TRACE knox.gateway
> (UrlRewriteProcessor.java:rewrite(167)) - Failed to rewrite URL:
> https://host:443/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state,
> direction: OUT via rule: YARNUI/yarn/outbound/node2, status: FAILURE
> {code}
> This suggests that the original URL path is rewritten twice.
> I suspect it is these two filter rules that's doing the double rewrite.
> {code:java}
> <filter name="YARNUI/yarn/outbound/filter/cluster">
> <content type="*/html">
> <apply
> path="(https?://[^/':,]+:[\d]+)?/ws/v1/cluster/apps/application"
> rule="YARNUI/yarn/outbound/apps/cluster1"/>
> <apply path="/ws/v1/.*" rule="YARNUI/yarn/outbound/ws1"/>
> <!-- snip -->
> </content>
> </filter>
> {code}
> Originally, it is: /ws/v1/cluster/apps/application_1611223368889_0003/state
> The first apply path rule matches and rewrites it to:
> [https://host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state|https://host/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state]
> The second apply rule also matches and rewrites it to:
> [https://host:443/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state|https://host/gateway/proxy/yarnhttps:/host:443/gateway/proxy/yarn/ws/v1/cluster/apps/application_1611223368889_0003/state]
> The broken link is then passed through the rewrite rule processor again,
> doesn't match anything, so a FAILURE logline is written.
>
> The final output of the filtered html is:
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)