Redirect http to https "solved"

Discussion in 'ISPConfig 3 Priority Support' started by ganewbie, Dec 2, 2016.

  1. ganewbie

    ganewbie Member HowtoForge Supporter

    Although I have couple of panels working ut my latest VPS is not behaving for some unknown reason.
    server is perfect server debian Jessie php 7
    I have done th efollowing and I get message "the site cannot be reached" when I do not add https.
    Here is what I have:
    Screen Shot 2016-12-01 at 9.39.57 PM.png Screen Shot 2016-12-01 at 9.40.38 PM.png
    I have added the following in .htaccess as well but no luck
    Code:
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    What could be the problem?
    Thanks,
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    are you able to reach the site with http and https successfully when you do not have this redirect? This is the prerequisite to add a redirect from http to https that both protocols are working.
     
  3. ganewbie

    ganewbie Member HowtoForge Supporter

    Thanks for the quick reply,
    Well, I am not sure at what point it broke but currently no matter what you do http does not work.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Remove the redirect, then try to use http. If it does not work, which exact error do you get in the browser and which messages do you get in the access.log file of the website for this request. The problem can also be a cms system in that site.

    and https is working fine, you can access the site trough https and it works?
     
  5. ganewbie

    ganewbie Member HowtoForge Supporter

    Thanks Till for the responsse, cannot solve my problem yet.
    Yes, I can access https normal no problem but http does not work at all. When i added the default index file for ISPCONFIG3 and remove CMS, the same behaviour still there. http does not work browser shows:
    This site can’t be reached
    http://example.com/ is unreachable.
    The access log shows the following:
    Code:
    127.0.0.1 - - [05/Dec/2016:07:30:02 -0500] "GET /HTTP/1.1" 200 10975 "-" "Mozilla/5.0 (ISPConfig monitor)"
    
    I think error in apache does not make sense as it is not working with or without the SSL since I have tried to remove the SSL completely
    Code:
    [Mon Dec 05 08:34:04.807244 2016] [ssl:error] [pid 30922] AH02567: Unable to configure certificate srv.example.com:8080:0 for stapling
    [Mon Dec 05 08:34:04.815302 2016] [mpm_prefork:notice] [pid 30922] AH00163: Apache/2.4.10 (Debian) mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_fcgid/2.3.9 Phusion_Passenger/4.0.53 mod_python/3.3.1 Python/2.7.9 OpenSSL/1.0.2j configured -- resuming normal operations
    [Mon Dec 05 08:34:04.815359 2016] [core:notice] [pid 30922] AH00094: Command line: '/usr/sbin/apache2'
    Thanks,
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    When the domain name is unreachable then you have probably a dns error and not a problem in apache. check with e.g. intodns.com that the dns of that domain is setup correctly and that it points to the right ip address.

    That's ok and not related to your website problem.
     
  7. ganewbie

    ganewbie Member HowtoForge Supporter

    Thanks Till,
    Here is the solution in case somebody gets in this scenario, it was very simple and has nothing to do with ISPConfig3 panel, I had port 80 closed in my router thus the redirect did not work.
    Thanks to Florian for the great service.
    https://www.schaal-it.com/corporation/contact/
     
  8. sjau

    sjau Local Meanie Moderator

    Apache does recommend to use redirect instead of rewrite:
    Code:
    Redirect permanent / https://mysite.example.com/
    
    The only drawback is, you have to set this for every vhost and it doesn't work with variable such as rewrite does. It needs to have fixed stuff.
    https://wiki.apache.org/httpd/RedirectSSL
    The main advantage is though, that it won't collide with other rewrite rules.
     
    ganewbie likes this.

Share This Page