[ 
https://issues.apache.org/jira/browse/KNOX-1274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16469460#comment-16469460
 ] 

Sandeep More commented on KNOX-1274:
------------------------------------

[~mgaido] I have committed KNOX-1305 to master, so the following rewrite rules 
can be used to rewrite location headers

rewrite.xml
{code}
<!-- SRM -->
    <rule dir="OUT" 
name="SPARKHISTORYUI/sparkhistory/outbound/headers/location/sso">
      <match 
pattern="{scheme}://{host}:{port}/{gateway}/{knoxsso}/{api}/{v1}/{websso}?originalUrl={**}"/>
      <rewrite 
template="{scheme}://{host}:{port}/{gateway}/{knoxsso}/{api}/{v1}/{websso}?originalUrl={$postfix[url,/sparkhistory/]}"/>
    </rule>
    
    <!-- SRM -->
    <filter name="SPARKHISTORYUI/sparkhistory/outbound/headers/sso/filter">
      <content type="application/x-http-headers">
        <apply path="Location" 
rule="SPARKHISTORYUI/sparkhistory/outbound/headers/location/sso"/>
      </content>
    </filter>
{code}

service.xml
{code}
   <route path="/sparkhistory">
      <rewrite apply="SPARKHISTORYUI/sparkhistory/outbound/headers/sso/filter" 
to="response.headers"/>
    </route>
{code}

Let me know if you have any issues. 

> SSO redirect for Spark2 History Server needs to be rewritten
> ------------------------------------------------------------
>
>                 Key: KNOX-1274
>                 URL: https://issues.apache.org/jira/browse/KNOX-1274
>             Project: Apache Knox
>          Issue Type: Bug
>            Reporter: Marco Gaido
>            Assignee: Sandeep More
>            Priority: Major
>             Fix For: 1.1.0
>
>
> When Spark2 History Server is accessed through Knox gateway and Knox SSO is 
> configured, after the authentication, the SSO redirects to the direct Spark 
> History Server's URL, instead of the proxied one, ie. one gets redirected to: 
> {{https://knox_host:8443/gateway/knoxsso/knoxauth/login.html?originalUrl=http://shs_host:18081/&do....}}
>  and so after the login, it redirects to {{http://shs_host:18081/&doAs=...}}, 
> instead of {{https://knox_host:8443/gateway/default/sparkhistory}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to