Skip to content

[SPARK-34635][UI] Add trailing slashes in URLs to reduce unnecessary redirects#31753

Closed
gengliangwang wants to merge 1 commit intoapache:masterfrom
gengliangwang:reduceRedirect
Closed

[SPARK-34635][UI] Add trailing slashes in URLs to reduce unnecessary redirects#31753
gengliangwang wants to merge 1 commit intoapache:masterfrom
gengliangwang:reduceRedirect

Conversation

@gengliangwang
Copy link
Member

What changes were proposed in this pull request?

Add trailing slashes in URLs of Spark UI pages.

Why are the changes needed?

When a user accesses a URL without a trailing slash, Spark UI always responds with a 302 redirect to a URL with a trailing slash.
image

Adding trailing slash to URLs in UI pages can reduce such unnecessary redirects

Does this PR introduce any user-facing change?

No

How was this patch tested?

Manual test. It's a very simple change.

@dongjoon-hyun
Copy link
Member

Thank you, @gengliangwang .

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM.

@dongjoon-hyun
Copy link
Member

BTW, are these all places, @gengliangwang ?

Copy link
Member

@sarutak sarutak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gengliangwang . It LGTM.

@gengliangwang
Copy link
Member Author

BTW, are these all places, @gengliangwang ?

@dongjoon-hyun That's all I can find for now.

@AmplabJenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/135795/

@dongjoon-hyun
Copy link
Member

Merged to master for Apache Spark 3.2.0. Thank you, @gengliangwang and all!

@AmplabJenkins
Copy link

Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/40377/

dongjoon-hyun added a commit that referenced this pull request Sep 17, 2023
…Page` urls

### What changes were proposed in this pull request?

This PR aims to use the same pattern for `logPage` urls of `WorkerPage` to make it work consistently when `spark.ui.reverseProxy=true`.

### Why are the changes needed?

Since Apache Spark 3.2.0 (SPARK-34635, #31753), Apache Spark adds trailing slashes to reduce redirections for `logPage`.

```scala
      s"$workerUrlRef/logPage?driverId=$driverId&logType=stdout")
      s"$workerUrlRef/logPage/?driverId=$driverId&logType=stdout")
...
<a href={s"$workerUrlRef/logPage?appId=${executor
<a href={s"$workerUrlRef/logPage/?appId=${executor
```

This PR aims to fix a leftover in `WorkerPage` to make it work consistently in case of the reverse proxy situation via `spark.ui.reverseProxy`. Currently,  in some proxy environments, `appId` link is working but `driverId` link is broken due to the redirections. This inconsistent behavior makes the users confused.

```
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Manual tests because it requires a reverse proxy.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #42959 from dongjoon-hyun/SPARK-45187.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
dongjoon-hyun added a commit that referenced this pull request Sep 17, 2023
…Page` urls

### What changes were proposed in this pull request?

This PR aims to use the same pattern for `logPage` urls of `WorkerPage` to make it work consistently when `spark.ui.reverseProxy=true`.

### Why are the changes needed?

Since Apache Spark 3.2.0 (SPARK-34635, #31753), Apache Spark adds trailing slashes to reduce redirections for `logPage`.

```scala
      s"$workerUrlRef/logPage?driverId=$driverId&logType=stdout")
      s"$workerUrlRef/logPage/?driverId=$driverId&logType=stdout")
...
<a href={s"$workerUrlRef/logPage?appId=${executor
<a href={s"$workerUrlRef/logPage/?appId=${executor
```

This PR aims to fix a leftover in `WorkerPage` to make it work consistently in case of the reverse proxy situation via `spark.ui.reverseProxy`. Currently,  in some proxy environments, `appId` link is working but `driverId` link is broken due to the redirections. This inconsistent behavior makes the users confused.

```
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Manual tests because it requires a reverse proxy.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #42959 from dongjoon-hyun/SPARK-45187.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit f8f2735)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
dongjoon-hyun added a commit that referenced this pull request Sep 17, 2023
…Page` urls

### What changes were proposed in this pull request?

This PR aims to use the same pattern for `logPage` urls of `WorkerPage` to make it work consistently when `spark.ui.reverseProxy=true`.

### Why are the changes needed?

Since Apache Spark 3.2.0 (SPARK-34635, #31753), Apache Spark adds trailing slashes to reduce redirections for `logPage`.

```scala
      s"$workerUrlRef/logPage?driverId=$driverId&logType=stdout")
      s"$workerUrlRef/logPage/?driverId=$driverId&logType=stdout")
...
<a href={s"$workerUrlRef/logPage?appId=${executor
<a href={s"$workerUrlRef/logPage/?appId=${executor
```

This PR aims to fix a leftover in `WorkerPage` to make it work consistently in case of the reverse proxy situation via `spark.ui.reverseProxy`. Currently,  in some proxy environments, `appId` link is working but `driverId` link is broken due to the redirections. This inconsistent behavior makes the users confused.

```
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Manual tests because it requires a reverse proxy.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #42959 from dongjoon-hyun/SPARK-45187.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit f8f2735)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit 84a053e)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
dongjoon-hyun added a commit that referenced this pull request Sep 17, 2023
…Page` urls

### What changes were proposed in this pull request?

This PR aims to use the same pattern for `logPage` urls of `WorkerPage` to make it work consistently when `spark.ui.reverseProxy=true`.

### Why are the changes needed?

Since Apache Spark 3.2.0 (SPARK-34635, #31753), Apache Spark adds trailing slashes to reduce redirections for `logPage`.

```scala
      s"$workerUrlRef/logPage?driverId=$driverId&logType=stdout")
      s"$workerUrlRef/logPage/?driverId=$driverId&logType=stdout")
...
<a href={s"$workerUrlRef/logPage?appId=${executor
<a href={s"$workerUrlRef/logPage/?appId=${executor
```

This PR aims to fix a leftover in `WorkerPage` to make it work consistently in case of the reverse proxy situation via `spark.ui.reverseProxy`. Currently,  in some proxy environments, `appId` link is working but `driverId` link is broken due to the redirections. This inconsistent behavior makes the users confused.

```
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Manual tests because it requires a reverse proxy.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #42959 from dongjoon-hyun/SPARK-45187.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit f8f2735)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit 84a053e)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit b4eb947)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
viirya pushed a commit to viirya/spark-1 that referenced this pull request Oct 19, 2023
…Page` urls

### What changes were proposed in this pull request?

This PR aims to use the same pattern for `logPage` urls of `WorkerPage` to make it work consistently when `spark.ui.reverseProxy=true`.

### Why are the changes needed?

Since Apache Spark 3.2.0 (SPARK-34635, apache#31753), Apache Spark adds trailing slashes to reduce redirections for `logPage`.

```scala
      s"$workerUrlRef/logPage?driverId=$driverId&logType=stdout")
      s"$workerUrlRef/logPage/?driverId=$driverId&logType=stdout")
...
<a href={s"$workerUrlRef/logPage?appId=${executor
<a href={s"$workerUrlRef/logPage/?appId=${executor
```

This PR aims to fix a leftover in `WorkerPage` to make it work consistently in case of the reverse proxy situation via `spark.ui.reverseProxy`. Currently,  in some proxy environments, `appId` link is working but `driverId` link is broken due to the redirections. This inconsistent behavior makes the users confused.

```
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
-        <a href={s"$workerUrlRef/logPage?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stdout"}>stdout</a>
+        <a href={s"$workerUrlRef/logPage/?driverId=${driver.driverId}&logType=stderr"}>stderr</a>
```

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Manual tests because it requires a reverse proxy.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#42959 from dongjoon-hyun/SPARK-45187.

Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit f8f2735)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit 84a053e)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants