This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new c9a538c3ad Change default for useRedirect from true to false
c9a538c3ad is described below
commit c9a538c3ad705c0861b6ee58fbea75a894696a3c
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 dd5f22e219..80883f51a7 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 338ef2448e..36242452a2 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 f12c72a2c4..eb5cbd95e2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -248,6 +248,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 e150bf7146..b73a554d06 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -2492,9 +2492,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]