Nflrijal commented on code in PR #58243:
URL: https://github.com/apache/spark/pull/58243#discussion_r3929759202


##########
core/src/main/scala/org/apache/spark/ui/JettyUtils.scala:
##########
@@ -222,6 +244,15 @@ private[spark] object JettyUtils extends Logging {
           val newHeader = createProxyLocationHeader(headerValue, clientRequest,
             serverResponse.getRequest().getURI())
           if (newHeader != null) {
+            if (normalizedReverseProxyUrl.nonEmpty) {
+              val scheme = clientRequest.getScheme
+              val host = Option(clientRequest.getHeader("host")).getOrElse("")
+              val rootProxyPrefix = s"$scheme://$host/proxy/"
+              if (newHeader.startsWith(rootProxyPrefix)) {
+                val rest = newHeader.substring(rootProxyPrefix.length)
+                return s"$normalizedReverseProxyUrl/proxy/$rest"

Review Comment:
   Updated the worker JSON endpoint test URL in MasterWorkerUISuite to 
s"$masterUrl/proxy/${workerId}/json/" (with trailing slash) so Source.fromURL 
fetches the JSON payload directly without following 302 redirects to 
unresolvable test hostnames (http://proxyhost:8080).



##########
core/src/main/scala/org/apache/spark/ui/UIUtils.scala:
##########
@@ -201,7 +201,14 @@ private[spark] object UIUtils extends Logging {
       request: HttpServletRequest,
       basePath: String = "",
       resource: String = ""): String = {
-    uiRoot(request) + basePath + resource
+    val root = uiRoot(request).stripSuffix("/")
+    val cleanBase = if (basePath.startsWith("/")) basePath
+                    else if (basePath.nonEmpty) "/" + basePath

Review Comment:
   Updated UIUtils.prependBaseUri to recognize absolute URIs starting with 
http:// or https:// (such as http://localhost:4040 in StoragePageSuite), 
preserving them as-is without prepending /



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to