]> source.dussan.org Git - gitblit.git/commitdiff
fix: Fix jetty crashing when redirecting HTTP to HTTPS
authorFlorian Zschocke <f.zschocke+git@gmail.com>
Fri, 11 Nov 2022 17:53:57 +0000 (18:53 +0100)
committerFlorian Zschocke <f.zschocke+git@gmail.com>
Fri, 11 Nov 2022 17:53:57 +0000 (18:53 +0100)
Jetty 9.3 changed the `setHandler` on the ServletContextHandler to no
longer automatically detect SecurityHandler, SessionHandler, etc. It
simply passes on the setHandler request to the ContextHandler class
(with a warning logged). So make sure to explicitly use the method
`setSecurityHandler` to set the ContraintSecurityHandler responsible
for the http -> https redirection.

src/main/java/com/gitblit/GitBlitServer.java

index 6391412122bc5a1473d9b50f84694cd153963bc0..ae01e8e0f55d0b203664d4011f9abf858552282c 100644 (file)
@@ -453,7 +453,7 @@ public class GitBlitServer {
                        sh.setConstraintMappings(new ConstraintMapping[] { cm });
 
                        // Configure this context to use the Security Handler defined before
-                       rootContext.setHandler(sh);
+                       rootContext.setSecurityHandler(sh);
                }
 
                // Setup the Gitblit context