Time Lag for Force HTTPS Redirect to Take Effect?

linux4me2

Well-Known Member
Aug 21, 2015
236
61
28
USA
cPanel Access Level
Root Administrator
I've been testing WHM 80's Force HTTPS Redirect, and it seems like there is a time lag before it takes effect, though it does seem to work eventually. The time lag makes me a little uneasy to roll it out to production sites in lieu of an .htaccess HTTPS redirect that they are already using.

Is the time lag expected, and what's the cause?
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
7,940
630
263
Houston
cPanel Access Level
DataCenter Provider
Hi @linux4me2

I believe you're referencing the new feature in cPanel's domains interface correct?

HTTPS redirection of websites
In cPanel & WHM version 80, we added the Force HTTPS Redirect toggle to cPanel's Domains interface (cPanel >> Home >> Domains >> Domains). This feature automatically redirects any visitors who attempt to access the insecure version of a website (HTTP) to the secure version (HTTPS).

You can only enable redirection on main domains that also possess a valid SSL certificate.
I found that if you're running php-fpm the change will not take place immediately, or until PHP-FPM is restarted. I'm doing some further testing on this and I'll update with my findings as soon as possible.


Thanks!
 
  • Like
Reactions: linux4me2

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
7,940
630
263
Houston
cPanel Access Level
DataCenter Provider
Sorry I didn't see your response before I responded again. I was looking at a case for this but I believe I've ruled it out as you're not running LSAPI. One thing I did notice on systems without FPM was that if the taskqueue was busy or there are a lot of domains (as it runs update_users_vhosts) there could be a delay between submission and the actual execution of the apache restart.

I'd suggest opening a ticket, I believe there may be a new related case here or at the very least some configuration issue causing the delay with PHP-FPM. Can you please open a ticket using the link in my signature? Once open please reply with the Ticket ID here so that we can update this thread with the resolution once the ticket is resolved.


Thanks!
 
  • Like
Reactions: linux4me2

linux4me2

Well-Known Member
Aug 21, 2015
236
61
28
USA
cPanel Access Level
Root Administrator
I'd like to, but I'm using leased cPanel/WHM, so I'd have to go through my host, and that doesn't work too well. I just tried another account using WordPress, and there was no delay. I've got a few more to try, and I'll experiment by restarting PHP-FPM if there is lag for one of them.
 
  • Like
Reactions: cPanelLauren

linux4me2

Well-Known Member
Aug 21, 2015
236
61
28
USA
cPanel Access Level
Root Administrator
I did not know that. I never got past the warning that I needed to go through my hosting provider. That's good to know. Let me try a few more accounts to see if I'm still experiencing the lag. If I do, I'll submit a support ticket.
 
  • Like
Reactions: cPanelLauren

linux4me2

Well-Known Member
Aug 21, 2015
236
61
28
USA
cPanel Access Level
Root Administrator
I just upgraded five WordPress sites to SSL, and only one of the five showed any delay with the HTTPS redirect. I restarted PHP-FPM and it made no difference. Then, I restarted Apache, and it didn't make any difference, but within a few minutes, the redirect began working. So I would say PHP-FPM and Apache are not the cause. I am using WP Super Cache on the sites, and tried clearing the cache, too, but that made no difference. I'm not using any server-level caching or Cloudflare.

My original post here was prompted by seeing the delay in redirect taking effect on three plain HTML sites, which, unlike WordPress, don't include their own redirect, which WordPress does when the Site and Home URLs are set in WordPress to HTTPS. So, I went back to one of the plain HTML sites, which has no caching whatsoever, and disabled the HTTPS redirect, then tried to browse to the site using HTTP, and I was still redirected to HTTPS. I restarted PHP-FPM, and was still redirected to HTTPS with the redirect disabled. Next, I tried a virgin browser that had not visited the site since I enabled SSL, and tried to pull up the site using HTTP. I still got redirected HTTPS, so I don't think it's the browser.

I'm going to think about this and see if I can come up with a reason the delay occurs, but I don't think it's worth a support ticket. It's not a big deal; the redirect worked immediately 80% of the time with WordPress sites, and even when it didn't work immediately, it began working after just a few minutes. I will probably never need to use the feature again once it's enabled. I'll just remember that it takes a few minutes to work. I only posted because I was curious about it, and thought it might be inherent in how the redirect is done.

I'm going to use the HTTPS redirect on my sites that have been using an .htaccess HTTPS redirect; I'll just wait a little while before removing the redirect from my .htaccess.
 
  • Like
Reactions: cPanelLauren