Skip to main content
Skip table of contents

HTTPS Configuration & HTTP-to-HTTPS Redirect

You can set up an HTTPS configuration and then configure a redirect from HTTP to HTTPS. Both operations are done in a couple of easy steps and with several commands we give below (please note that the Server has to be running during their execution). The commands are ready to use; you only have to customize two elements to match your local system: path=https.keystore and credential-reference={clear-text="dvserver"}.

HTTPS Configuration

  1. Create the self-signed certificate:
    1. Adapt and run the following command:

      ./dvserver/JDK/bin/keytool -genkey -alias wildfly -keyalg RSA -keystore ./dvserver/standalone/configuration/https.keystore
    2. Set a password when prompted by the system.
  2. Adapt the elytron subsystem by running the following commands (remember to customize path=https.keystore and credential-reference={clear-text="dvserver"}):

    CALL SYSADMIN.executeCli(script => '/subsystem=elytron/key-store=httpsKeyStore:add(path=https.keystore,relative-to=jboss.server.config.dir, credential-reference={clear-text="dvserver"},type=JKS)') ;;
    CALL SYSADMIN.executeCli(script => '/subsystem=elytron/key-manager=httpsKeyManager:add(key-store=httpsKeyStore,credential-reference={clear-text="dvserver"})') ;;
    CALL SYSADMIN.executeCli(script => '/subsystem=elytron/server-ssl-context=httpsSSLContext:add(key-manager=httpsKeyManager,protocols=["TLSv1.2"])') ;;
  3. Adapt the undertow subsystem by running the following command:

    CALL SYSADMIN.executeCli(script => '/subsystem=undertow/server=default-server/https-listener=https:add(socket-binding=https, ssl-context="httpsSSLContext", enable-http2="true")') ;;

    With this, the HTTPS configuration is finished. In addition to the usual HTTP localhost (http://localhost:8080), an HTTPS localhost is now available (https://localhost:8443/). If you want to set up HTTPS redirect, one additional step remains - see below!

HTTP-to-HTTPS Redirect

To set up HTTP to HTTPS redirect, run the following commands:

CALL SYSADMIN.executeCli(script => '/subsystem=undertow/configuration=filter/rewrite=http-to-https:add(redirect=true, target="https://%{LOCAL_SERVER_NAME}:${jboss.https.port:8443}%{REQUEST_URL}%{QUERY_STRING}")') ;;

CALL SYSADMIN.executeCli(script => '/subsystem=undertow/server=default-server/host=default-host/filter-ref=http-to-https:add(predicate="equals(%{SCHEME},http)")') ;;
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.