Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private[ui] class EnvironmentPage(

val content =
<div>
<p><a href="/">Back to Master</a></p>
<p><a href={UIUtils.prependBaseUri(request, "/")}>Back to Master</a></p>
</div>
<span>
<span class="collapse-table" data-bs-toggle="collapse"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private[ui] class LogPage(parent: MasterWebUI) extends WebUIPage("logPage") with
val content =
<script type="module" src={UIUtils.prependBaseUri(request, "/static/utils.js")}></script> ++
<div>
<p><a href="/">Back to Master</a></p>
<p><a href={UIUtils.prependBaseUri(request, "/")}>Back to Master</a></p>
{range}
<div class="log-content overflow-auto p-1" style="height:80vh;">
<div>{moreButton}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ private[ui] class MasterPage(parent: MasterWebUI) extends WebUIPage("") {
{state.completedDrivers.count(_.state == DriverState.RELAUNCHING)} Relaunching)
</li>
<li><strong>Status:</strong> {state.status}
(<a href={"/environment/"}>Environment</a>,
<a href={"/logPage/?self&logType=out"}>Log</a>)
(<a href={UIUtils.prependBaseUri(request, "/environment/")}>Environment</a>,
<a href={UIUtils.prependBaseUri(request, "/logPage/?self&logType=out")}>Log</a>)
</li>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ trait MasterSuiteBase extends SparkFunSuite
// groups represent URL and worker ID
val WORKER_LINK_RE = """<a href="(.+?)">\s*(worker-.+?)\s*</a>""".r

// regex to extract site-relative links from the webui HTML
val SITE_RELATIVE_LINK_RE = """href="(/[^"]*)"""".r

private var _master: Master = _

after {
Expand Down Expand Up @@ -179,6 +182,9 @@ trait MasterSuiteBase extends SparkFunSuite
html should include (s"""href="$proxyUrl/static""")
html should not include ("""src="/static""")
html should include (s"""src="$proxyUrl/static""")
// other site-relative links, e.g. "Back to Master", must not bypass the proxy either
(SITE_RELATIVE_LINK_RE findAllMatchIn html).map(_.group(1))
.filterNot(_.startsWith(proxyUrl)).toSeq shouldBe empty
}

protected def verifyDrivers(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ class MasterWorkerUISuite extends MasterSuiteBase {
.tryWithResource(Source.fromURL(s"$masterUrl/"))(_.getLines().mkString("\n"))
html should include ("Spark Master at spark://")
verifyStaticResourcesServedByProxy(html, reverseProxyUrl)
Seq("environment/", "logPage/?self&logType=out").foreach { path =>
val pageHtml = Utils
.tryWithResource(Source.fromURL(s"$masterUrl/$path"))(_.getLines().mkString("\n"))
withClue(s"$path: ") {
verifyStaticResourcesServedByProxy(pageHtml, reverseProxyUrl)
}
}
verifyWorkerUI(html, masterUrl, reverseProxyUrl)
}
} finally {
Expand Down