Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-28504

Web UI does not always honor spark.ui.proxyBase and X-Forwarded-Context

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Incomplete
    • 2.4.3
    • None
    • Web UI

    Description

      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:

      1. 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/.
      2. 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:

      1. HistoryServer#loaderServlet
      2. JettyUtils#createRedirectHandler

      I do not know if this is a complete list but I think these instances can be fixed by using UIUtils.uiRoot.

      // HistoryServer
      val requestURI = UIUtils.uiRoot(req) + Option(req.getQueryString).map("?" + _).getOrElse("")
      
      // JettyUtils
      val newUrl = new URL(new URL(UIUtils.uiRoot(request)), prefixedDestPath).toString

      Attachments

        Activity

          People

            Unassigned Unassigned
            winkelman.kyle Kyle Winkelman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: