Issue #1771 - add module for secure redirect

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2022-05-12 17:36:14 +10:00 committed by Olivier Lamy
parent 513a2cb256
commit 365fa76db3
3 changed files with 40 additions and 1 deletions

View File

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Get id="Handler" name="handler"/>
<Call name="setHandler">
<Arg>
<New class="org.eclipse.jetty.server.handler.HandlerList">
<Call name="addHandler">
<Arg>
<New id="SecuredRedirectHandler" class="org.eclipse.jetty.server.handler.SecuredRedirectHandler">
<Arg type="int"><Property name="jetty.redirect.code" default="302"/></Arg>
</New>
</Arg>
</Call>
<Call name="addHandler">
<Arg><Ref refid="Handler"/></Arg>
</Call>
</New>
</Arg>
</Call>
</Configure>

View File

@ -60,7 +60,7 @@
<!-- =========================================================== -->
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Set name="secureScheme" property="jetty.httpConfig.secureScheme"/>
<Set name="securePort" property="jetty.httpConfig.securePort"/>
<Set name="securePort"><Property name="jetty.httpConfig.securePort" default="8443"/></Set>
<Set name="outputBufferSize" property="jetty.httpConfig.outputBufferSize"/>
<Set name="outputAggregationSize" property="jetty.httpConfig.outputAggregationSize"/>
<Set name="requestHeaderSize" property="jetty.httpConfig.requestHeaderSize"/>

View File

@ -0,0 +1,17 @@
DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Enable SecuredRedirectHandler to redirect all http requests to https.
[tags]
handler
[depend]
server
[xml]
etc/jetty-secure-redirect.xml
[ini-template]
## The redirect code to use in the response.
# jetty.redirect.code=302