Nflrijal opened a new pull request, #59089: URL: https://github.com/apache/spark/pull/59089
### What changes were proposed in this pull request? When `spark.ui.reverseProxy=true` is enabled in Standalone multi-cluster deployments: 1. `SparkContext` on the driver did not receive `UI_REVERSE_PROXY_URL`, causing driver UI links to drop `/proxy/<id>` prefixes. This PR propagates `UI_REVERSE_PROXY_URL` (or falls back to `spark.ui.proxyBase`) into system property `spark.ui.proxyBase`. 2. `Master` did not pass `-Dspark.ui.reverseProxyUrl=<url>` to `DriverDescription` `javaOpts`. This PR updates `Master` to inject `reverseProxyUrl` into driver `javaOpts` when reverse proxy is enabled. 3. `/app/kill` and `/driver/kill` redirect `Location` headers caused path doubling (e.g., `/spark/spark/`) behind frontend proxies like Nginx/Knox. This PR updates `MasterWebUI` redirect target to `/` so reverse proxies handle root-relative redirects cleanly. 4. `UIUtils.prependBaseUri` and `uiRoot` were updated to handle `request = null` safely. 5. `SparkContext.stop()` was updated to restore `spark.ui.proxyBase` before `clearActiveContext()` to prevent race conditions with replacement contexts. ### Why are the changes needed? Without these changes, multi-cluster reverse proxy deployments lose proxy prefixes when accessing driver UIs or terminating applications/drivers from Master UI, breaking navigation and reverse proxy routing. ### Does this PR introduce _any_ user-facing change? No API changes. Fixes UI navigation links and redirect Location headers when `spark.ui.reverseProxy=true` is enabled. ### How was this patch tested? - Added unit tests in `UIUtilsSuite`, `MasterSuite`, `MasterWebUISuite`, `MasterWorkerUISuite`, and `SparkContextSuite`. - Scalastyle & local unit tests passed 100%. ### Was this patch authored or co-authored using generative AI tooling? No. -- 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]
