Prev: Next: Up: HTTPS[Contents][Index]


5.2 Redirect HTTP to HTTPS

Nowadays it is common to redirect all plain HTTP requests to HTTPS on the same URL. The method of doing so was described in HTTP to HTTPS. As an example, this section shows a working HTTPS configuration with such redirect.

ListenHTTP
    Address 0.0.0.0
    Port 80
    Service
        Redirect 301 "https://%[host]%[url]"
    End
End

ListenHTTPS
    Address 0.0.0.0
    Port 443
    Cert "/etc/ssl/priv/example.pem"
    Disable TLSv1
    Service
        Backend
            Address 127.0.0.1
            Port 8080
        End
    End
End