You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Jean-Christophe Dauchy (Jira)" <ji...@apache.org> on 2019/12/18 14:30:00 UTC

[jira] [Commented] (SPARK-28504) Web UI does not always honor spark.ui.proxyBase and X-Forwarded-Context

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

Jean-Christophe Dauchy commented on SPARK-28504:
------------------------------------------------

Tested your implementation, it does not work :(

But applied this Jira and it worked : [SPARK-30240][core] Support HTTP redirects directly to a proxy server

It crashes with the following stack trace :

java.net.MalformedURLException: no protocol:
 at java.net.URL.<init>(URL.java:593)
 at java.net.URL.<init>(URL.java:490)
 at java.net.URL.<init>(URL.java:439)
 at org.apache.spark.ui.JettyUtils$$anon$4.doRequest(JettyUtils.scala:179)
 at org.apache.spark.ui.JettyUtils$$anon$4.doGet(JettyUtils.scala:161)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
 at org.spark_project.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
 at org.spark_project.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772)
 at org.apache.spark.deploy.history.ApplicationCacheCheckFilter.doFilter(ApplicationCache.scala:405)
 at org.spark_project.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
 at org.spark_project.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
 at org.spark_project.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
 at org.spark_project.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
 at org.spark_project.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
 at org.spark_project.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
 at org.spark_project.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
 at org.spark_project.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
 at org.spark_project.jetty.server.Server.handle(Server.java:539)
 at org.spark_project.jetty.server.HttpChannel.handle(HttpChannel.java:333)
 at org.spark_project.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
 at org.spark_project.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
 at org.spark_project.jetty.io.FillInterest.fillable(FillInterest.java:108)
 at org.spark_project.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
 at org.spark_project.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
 at org.spark_project.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
 at org.spark_project.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
 at org.spark_project.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
 at org.spark_project.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
 at java.lang.Thread.run(Thread.java:748)

 

> Web UI does not always honor spark.ui.proxyBase and X-Forwarded-Context
> -----------------------------------------------------------------------
>
>                 Key: SPARK-28504
>                 URL: https://issues.apache.org/jira/browse/SPARK-28504
>             Project: Spark
>          Issue Type: Bug
>          Components: Web UI
>    Affects Versions: 2.4.3
>            Reporter: Kyle Winkelman
>            Priority: Major
>
> When running the Web UI behind a proxy, links in the html correctly honor spark.ui.proxyBase and X-Forwarded-Context in [UIUtils#uiRoot|[https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/ui/UIUtils.scala]].
> Two items that I have found that do not honor spark.ui.proxyBase and X-Forwarded-Context:
>  # History server links from the main page produce a request like [http://localhost:8888/proxy/18080/history/spark-application-1563978242545/1/jobs/] which will then redirect to [http://localhost:8888/history/spark-application-1563975642858/jobs/].
>  # Static redirects like when entering the Web UI with a request like [http://localhost:8888/proxy/4040] which will then redirect to [http://localhost:8888/jobs].
> I believe that these correspond to:
>  # [HistoryServer#loaderServlet|[https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/deploy/history/HistoryServer.scala#L100-L101|https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/deploy/history/HistoryServer.scala]]
>  # [JettyUtils#createRedirectHandler|[https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala#L124-L158]]
> I do not know if this is a complete list but I think these instances can be fixed by using UIUtils.uiRoot.
> {code:java}
> // HistoryServer
> val requestURI = UIUtils.uiRoot(req) + Option(req.getQueryString).map("?" + _).getOrElse("")
> // JettyUtils
> val newUrl = new URL(new URL(UIUtils.uiRoot(request)), prefixedDestPath).toString{code}



--
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