This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new 3314da3ba2 FELIX-6785 : Allow configuration of redirect handling
3314da3ba2 is described below
commit 3314da3ba2c49fe361eeaed8eac14910e9060a5e
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Fri May 30 09:38:19 2025 +0200
FELIX-6785 : Allow configuration of redirect handling
---
.../apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java | 6 ++++++
.../main/java/org/apache/felix/http/jetty/internal/JettyConfig.java | 3 +++
.../java/org/apache/felix/http/jetty/internal/JettyService.java | 5 +++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git
a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
index 630e226eaf..b6fa8ef492 100644
---
a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
+++
b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
@@ -524,6 +524,12 @@ class ConfigMetaTypeProvider implements MetaTypeProvider
"Whether to enable jetty specific WebSocket support. Default
is false.",
false,
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_WEBSOCKET_ENABLE)));
+ adList.add(new
AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_ALLOW_RELATIVE_REDIRECTS,
+ "Allow Relative Redirects",
+ "Whether or not relative redirects are allowed. Defaults to
true thus relative redirects are allowed.",
+ true,
+
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_ALLOW_RELATIVE_REDIRECTS)));
+
return new ObjectClassDefinition()
{
diff --git
a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
index 4116bba139..e14db27c1f 100644
---
a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
+++
b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
@@ -292,6 +292,9 @@ public final class JettyConfig
/** Felix specific property to control whether an OSGi configuration is
required */
private static final String FELIX_REQUIRE_OSGI_CONFIG =
"org.apache.felix.http.require.config";
+ /** Jetty specific property to control relative redirect handling
(defaults to true) */
+ public static final String FELIX_JETTY_ALLOW_RELATIVE_REDIRECTS =
"org.apache.felix.jetty.relativeredirectallowed";
+
private static String validateContextPath(String ctxPath)
{
// undefined, empty, or root context path
diff --git
a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
index 04dfc4e5f8..2dce509ec2 100644
---
a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
+++
b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
@@ -319,7 +319,7 @@ public final class JettyService
addErrorHandler(errorPageCustomHeaders);
}
- ServletContextHandler context = new
ServletContextHandler(this.config.getContextPath(),
+ ServletContextHandler context = new
ServletContextHandler(this.config.getContextPath(),
ServletContextHandler.SESSIONS);
this.parent = new ContextHandlerCollection(context);
@@ -742,7 +742,8 @@ public final class JettyService
config.setRequestHeaderSize(this.config.getHeaderSize());
config.setResponseHeaderSize(this.config.getHeaderSize());
config.setOutputBufferSize(this.config.getResponseBufferSize());
-
+
config.setRelativeRedirectAllowed(this.config.getBooleanProperty(JettyConfig.FELIX_JETTY_ALLOW_RELATIVE_REDIRECTS,
true));
+
String uriComplianceMode =
this.config.getProperty(JettyConfig.FELIX_JETTY_URI_COMPLIANCE_MODE, null);
if (uriComplianceMode != null) {
try {