You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Igor Shikin (Jira)" <ji...@apache.org> on 2019/11/05 16:29:00 UTC

[jira] [Commented] (SPARK-27996) Spark UI redirect will be failed behind the https reverse proxy

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

Igor Shikin commented on SPARK-27996:
-------------------------------------

I have fixed the History Server by adding

 

{{val redirect = Option(httpRequest.getHeader("X-Forwarded-Proto")) match {}}
{{  case Some(protocol) => protocol + redirectUrl.drop(redirectUrl.indexOf(":"))}}
{{  case _ => redirectUrl}}
{{}}}
{{httpResponse.sendRedirect(redirect)}}

 

in HistoryServer, ApplicationCache and JettyUtils. 

 

We are not using live UI, so it is probably not a complete solution. 

I am interested in contributing back, but I need guidance.

> Spark UI redirect will be failed behind the https reverse proxy
> ---------------------------------------------------------------
>
>                 Key: SPARK-27996
>                 URL: https://issues.apache.org/jira/browse/SPARK-27996
>             Project: Spark
>          Issue Type: Bug
>          Components: Web UI
>    Affects Versions: 2.4.3
>            Reporter: Saisai Shao
>            Priority: Minor
>
> When Spark live/history UI is proxied behind the reverse proxy, the redirect will return wrong scheme, for example:
> If reverse proxy is SSL enabled, so the client to reverse proxy is a HTTPS request, whereas if Spark's UI is not SSL enabled, then the request from reverse proxy to Spark UI is a HTTP request, Spark itself treats all the requests as HTTP requests, so the redirect URL is just started with "http", which will be failed to redirect from client. 
> Actually for most of the reverse proxy, the proxy will add an additional header "X-Forwarded-Proto" to tell the backend server that the client request is a https request, so Spark should leverage this header to return the correct URL.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org