Skip to main content

https not being forced after modifying apache configuration for reverse proxy

Comments

1 comment

  • cPRex Jurassic Moderator

    Hey there!  I wouldn't expect the cPanel >> Domains >> "Force HTTPS Redireciton" tool to work in this case, as that gets added to the Apache configuration's vhost for the domain.  Here is what that looks inside the Apache configuration on the machine:

    <VirtualHost 1.2.3.4:80>
    ServerName domain.com
        <IfModule rewrite_module>
        RewriteEngine On

                    RewriteCond %{REQUEST_URI} ^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$ [OR]
                RewriteCond %{REQUEST_URI} ^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Sectigo\ DCV)?$ [OR]
                RewriteCond %{REQUEST_URI} ^/\.well-known/pki-validation/(?:\ Ballot169)? [OR]
                RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
            RewriteRule ^ - [END]

        RewriteCond %{HTTP:X-Forwarded-Proto} !https
        RewriteCond %{HTTPS} !=on
        RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    Since your tool isn't using the standard ports, the redirection doesn't happen.

    Did you manually configure that proxy or was that setup using https://docs.cpanel.net/knowledge-base/web-services/nginx-with-reverse-proxy/.  If you're using our implementation of Nginx I'd expect the redirection to work.

    0

Please sign in to leave a comment.