This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 49c1a79f4a Change default for useRedirect from true to false
49c1a79f4a is described below
commit 49c1a79f4a983d65c18e65b5b32ff55c5cfe5c1e
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 ecef467206..0010397eec 100644
--- a/test/org/apache/catalina/valves/TestProxyErrorReportValve.java
+++ b/test/org/apache/catalina/valves/TestProxyErrorReportValve.java
@@ -67,6 +67,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");
@@ -188,11 +189,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 af3540311e..3e48817a61 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -259,6 +259,11 @@
Update default web.xml version to match supported Servlet specification
version. (markt)
</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 a3d4599ad8..b31d701d3e 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -2490,9 +2490,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]