SOLVED [CPANEL-22603] HTTPS Redirect Odd Behavior

MajorLancelot

Well-Known Member
Dec 17, 2014
73
5
133
Tokyo, Japan and Atlanta, Georgia
cPanel Access Level
Root Administrator
Hi.

Please, I need your insight on this.

Problem:
HTTPS redirection is not working when it set using cPanel Redirects.

The generated rule looks like this:

Code:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-SSL} off
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^(.*)$ "https\:\/\/example\.com\/$1" [R=301,L]
Temporary Solution:

For this to work, we remove: `RewriteCond %{HTTP:X-Forwarded-SSL} off` from the rule in .htaccess file.

Please, what could account for this?

Our assumption is that perhaps it is because Apache doesn’t have `X-Forwarded-SSL` variable and so cannot determine whether `RewriteCond %{HTTP:X-Forwarded-SSL}` is ON or OFF and thus give up.

Thanks a lot for your help!
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @MajorLancelot

I apologize for my delay in response to you. I was able to replicate this behavior and I subsequently opened an internal case on the matter CPANEL-22603

The only workaround I've found at this time is exactly what you noted as well - comment out the X-Forwarded-SSL line in the .htaccess.

I'll update this thread when there's more information on the internal case and/or once the issue is resolved.

Thanks!
 

AllanJ

Registered
Feb 1, 2018
1
0
1
Denmark
cPanel Access Level
Root Administrator
Just encountered this issue on v74.0.4.

Aside from deleting the line manually, changing to "X-Forwarded-Proto: !https" as a conditition instead appears to work fine to take proxies into account. This is also the recommended syntax by Mozilla it appears.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi All,


I'm updating this thread to let you all know that this issue is marked as resolved for v76 you can see the change in our ChangeLogs here: 76 Change Log - Change Logs - cPanel Documentation

To resolve this issue please update to v76 - if you experience any issues whatsoever please let us know here!


Thanks!