Module io.jooby

Class SSLHandler

java.lang.Object
io.jooby.handler.SSLHandler
All Implemented Interfaces:
Route.Aware, Route.Before, Route.Filter

public class SSLHandler extends Object implements Route.Before
Force SSL handler. Check for non-HTTPs request and force client to use HTTPs by redirecting the call to the HTTPs version.

If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set Router.setTrustProxy(boolean) option.

Author:
edgar
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a SSLHandler and redirect non-HTTPs requests to the HTTPS version of this call.
    SSLHandler(int port)
    Creates a SSLHandler and redirect non-HTTPs requests to the HTTPS version of this call.
    Creates a SSLHandler and redirect non-HTTPS request to the given host.
    SSLHandler(String host, int port)
    Creates a SSLHandler and redirect non-HTTPS request to the given host and port.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Execute application code before next handler.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.jooby.Route.Aware

    setRoute

    Methods inherited from interface io.jooby.Route.Before

    apply, then, then

    Methods inherited from interface io.jooby.Route.Filter

    then
  • Constructor Details

    • SSLHandler

      public SSLHandler(@NonNull String host, int port)
      Creates a SSLHandler and redirect non-HTTPS request to the given host and port.

      If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set Router.setTrustProxy(boolean) option.

      Parameters:
      host - Host to redirect.
      port - HTTP port.
    • SSLHandler

      public SSLHandler(@NonNull String host)
      Creates a SSLHandler and redirect non-HTTPS request to the given host.

      If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set Router.setTrustProxy(boolean) option.

      Parameters:
      host - Host to redirect.
    • SSLHandler

      public SSLHandler(int port)
      Creates a SSLHandler and redirect non-HTTPs requests to the HTTPS version of this call. Host is recreated from Host header or X-Forwarded-Host.

      If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set Router.setTrustProxy(boolean) option.

      Parameters:
      port - HTTPS port.
    • SSLHandler

      public SSLHandler()
      Creates a SSLHandler and redirect non-HTTPs requests to the HTTPS version of this call. Host is recreated from Host header.

      If you run behind a reverse proxy that has been configured to send the X-Forwarded-* header, please consider to set Router.setTrustProxy(boolean) option.

  • Method Details

    • apply

      public void apply(@NonNull Context ctx)
      Description copied from interface: Route.Before
      Execute application code before next handler.
      Specified by:
      apply in interface Route.Before
      Parameters:
      ctx - Web context.