Rewrite http->https not working [SOLVED]

Discussion in 'Installation/Configuration' started by Sir Henry, Dec 30, 2023.

  1. Sir Henry

    Sir Henry Member

    For some sites the http->https rewrite is not working on my server (Debian 10, Apache).
    The Rewrite HTTP to HTTPS checkbox in ISPConfig is checked.
    The generated and unmodified Apache vhost file contains the correct rewrite rule.
    Apache was restarted.
    No redirect is happening when I request the site with http://
    I am looking for ideas on how to troubleshoot this problem.
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Is this happening with several sites?
    Is for those sites the certificate ok when accessed with httpS://?
    Instead of redirecting, what happens? Do you see the correct website but browser address bar shows url as http://?
    If there is problem with certificate, this helps: https://forum.howtoforge.com/threads/lets-encrypt-error-faq.74179/
    If nothing helps, examine apache logs at the time when you try to access the site.
     
  3. Sir Henry

    Sir Henry Member

    Thanks for your reply.
    Yes, it happens with a few sites, but not with all.
    Yes, the certificate is completely fine.
    Yes.
    I did indeed have problems with Letsencrypt certificates because migration mode was still switched on from a previous migration a year ago and the certs were not properly renewed. Major problems were caused by the removal of sites from existing certificates. But after a lot of troubleshooting I solved these problems and could renew all certs. I am not sure how my current problem can be related to that because all certs are fine now.
    I don't see anything special there but I will increase the LogLevel to see more. Thanks so far.

    If you want to try yourself, please see http://www.annozone.de as an example.
     
    Last edited: Dec 31, 2023
  4. Sir Henry

    Sir Henry Member

    I think the redirect rule is not processed because it is the last rule and preceding subdomain rules are tagged with [L].
    But all rules were generated by ISPConfig, so is that a bug?
     
  5. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    In addition to turning on "Rewrite HTTP to HTTPS" have you set other redirect? What are those?
     
  6. Sir Henry

    Sir Henry Member

    Yes! That was the right question. I had several other redirects flagged with [L] preceding the http->https rule. But (as usual) it is not an ISPConfig issue. The problems were all homemade. S**t happens when you don't know what you are doing. In my case I was not aware of the implications the flag settings in sub- and alias domain configurations have on the https redirect rule.
    Thanks again for a good lesson learned!
     
  7. Sir Henry

    Sir Henry Member

    One last thought though: Shouldn't ISPConfig generate the https rule as its first rule? The [L] won't do any harm then, because all rules will be re-executed after the redirection.
     

Share This Page