This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 51abc2f092 Change default for useRedirect from true to false
51abc2f092 is described below
commit 51abc2f09215025bdd0540add6e025bb1e625e69
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Jun 9 10:16:22 2026 +0100
Change default for useRedirect from true to false
---
java/org/apache/catalina/valves/ProxyErrorReportValve.java | 4 ++--
test/org/apache/catalina/valves/TestProxyErrorReportValve.java | 7 ++++---
webapps/docs/changelog.xml | 5 +++++
webapps/docs/config/valve.xml | 9 ++++++---
4 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/java/org/apache/catalina/valves/ProxyErrorReportValve.java
b/java/org/apache/catalina/valves/ProxyErrorReportValve.java
index d5788a1d29..a13acf9ba4 100644
--- a/java/org/apache/catalina/valves/ProxyErrorReportValve.java
+++ b/java/org/apache/catalina/valves/ProxyErrorReportValve.java
@@ -58,9 +58,9 @@ public class ProxyErrorReportValve extends ErrorReportValve {
}
/**
- * Use a redirect or proxy the response to the specified location. Default
to redirect.
+ * Use a redirect or proxy the response to the specified location. Default
to not redirect.
*/
- protected boolean useRedirect = true;
+ protected boolean useRedirect = false;
/**
* Returns whether a redirect is used to send the error report to the
specified location.
diff --git a/test/org/apache/catalina/valves/TestProxyErrorReportValve.java
b/test/org/apache/catalina/valves/TestProxyErrorReportValve.java
index c5a9369396..ab5201199f 100644
--- a/test/org/apache/catalina/valves/TestProxyErrorReportValve.java
+++ b/test/org/apache/catalina/valves/TestProxyErrorReportValve.java
@@ -66,6 +66,7 @@ public class TestProxyErrorReportValve extends TomcatBaseTest
{
}
}
Assert.assertNotNull(valve);
+ valve.setUseRedirect(true);
valve.setProperty("errorCode." +
HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"http://localhost:" + getPort() + "/error-page");
@@ -187,11 +188,11 @@ public class TestProxyErrorReportValve extends
TomcatBaseTest {
public void testGetSetProperties() {
ProxyErrorReportValve valve = new ProxyErrorReportValve();
- Assert.assertTrue(valve.getUseRedirect());
+ Assert.assertFalse(valve.getUseRedirect());
Assert.assertFalse(valve.getUsePropertiesFile());
- valve.setUseRedirect(false);
- Assert.assertFalse(valve.getUseRedirect());
+ valve.setUseRedirect(true);
+ Assert.assertTrue(valve.getUseRedirect());
valve.setUsePropertiesFile(true);
Assert.assertTrue(valve.getUsePropertiesFile());
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index da647b3305..3bf90922ad 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -244,6 +244,11 @@
mod_rewrite, which follows a purely sequential evaluation strategy.
(remm)
</fix>
+ <fix>
+ Change the default for the <code>useRedirect</code> attribute of the
+ <code>ProxyErrorReportValve</code> from <code>true</code> to
+ <code>false</code>. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index a7324b41a7..cce96e05f8 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -2487,9 +2487,12 @@
</attribute>
<attribute name="useRedirect" required="false">
- <p>If <code>true</code>, the valve will send a redirect to the URL.
- If <code>false</code>, the valve will instead proxy the content from
- the specified URL. The default value is <code>true</code>.</p>
+ <p>If <code>true</code>, the valve will redirect the client to the URL
+ that displays the error and the redirect will include full details of
+ the error including the stack trace. If <code>false</code>, the valve
+ will instead proxy the content from the specified URL which allows the
+ proxy to filter the information presented to the client. The default
+ value is <code>false</code>.</p>
</attribute>
</attributes>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]