redirect http to https not work

Discussion in 'Installation/Configuration' started by Poliman, Aug 26, 2018.

  1. Poliman

    Poliman Member

    I have server with Debian 9, ISP 3.1.13, apache 2.4.25. There is website s1.sily-natury.pl. LE SSL works for it but after checking "Redirect HTTP to HTTPS" in ISP nothing happens beside added lines in .vhost file:
    Code:
                    RewriteEngine on
                    RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge/
                    RewriteRule ^ - [END]
            RewriteCond %{HTTPS} off
                    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
    
    Does anybody know what could makes this problem?
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What should happen instead?
    Are you sure the redirect does not work? How do you test it does not work?
     
  3. Poliman

    Poliman Member

    After check "Redirect HTTP to HTTPS" in ISP, code above appear in vhost file related with s1.sily-natury.pl but I still have to write https://s1.sily-natury.pl to get https. If I write just s1.sily-natury.pl I am not redirected to https://s1.sily-natury.pl. I tried on 3 computers and on each used Chrome, Firefox, Edge. This same on any. There is nothing in logs. I could put them.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Did you try to use ctrl + F5 in the browser to force it to reload the page? maybe your browser just loaded it from cache.
     
  5. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    The redirect does work with http://s1.sily-natury.pl:8080
    You have made the LE certificate for port 8080 only or the website is only on port 8080. Or something, I do not know how.
     
  6. Poliman

    Poliman Member

    I did in each browser ctrl+shift+del and deleted all things from beginning. Also tried ctrl+f5 and only f5. On this computer, http://s1.sily-natury.pl:8080 gives bad request due to lack of https. for s1.sily-natury.pl I set block 403. Of course when I do hhttps://s1.sily-natury.pl it is redirect to https://s1.sily-natury.pl:8080/login/, because I have created .htaccess with this kind of redirection. I tried remove it but nothing changes and still http to https does not working. What happens when you try open s1.sily-natury.pl. Will it be redirected to https://s1.sily-natury.pl or https://s1.sily-natury.pl:8080?
     
  7. Taleman

    Taleman Well-Known Member HowtoForge Supporter

  8. Poliman

    Poliman Member

    Hmm, strange thing. I didn't do anything, because I have whole accesses to server on my private PC in home. ;) Does your browser has empty cache? :)

    PS
    Do you know what could I check to fix this? I have checked on 5 computers and on each s1.sily-natury.pl didn't redirect to https.
     
    Last edited: Aug 28, 2018
  9. Ghostdare

    Ghostdare Member

    Here the same - not redirecting
    --
    Bad Request
    Your browser sent a request that this server could not understand.
    Reason: You're speaking plain HTTP to an SSL-enabled server port.
    Instead use the HTTPS scheme to access this URL, please.
    --
    I think you followed the tutorial Let's Encrypt and ISPConfig ... review the steps there, maybe did you miss something.
     
  10. Poliman

    Poliman Member

  11. Poliman

    Poliman Member

    It looks like that this kind of redirect done by ISP not works for subdomains. I added this redirection for main domain and works perfect. You can check (these are on next server, this time with Ubuntu 18.04 LTS) s1.niebianski-lad.pl and niebianski-lad.pl. Both are with redirect to https.
     
  12. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Check the vhost file of that domain whether it has one that ended with .err.
     
  13. Poliman

    Poliman Member

    Thank you for tip! I will check it and give feedback.

    EDIT
    There is nothing:
    Code:
    root@s1:/etc/apache2/sites-enabled# ls
    000-apps.vhost    000-ispconfig.conf   100-niebianski-lad.pl.vhost
    000-default.conf  000-ispconfig.vhost  100-s1.niebianski-lad.pl.vhost
     
    Last edited: Sep 11, 2018

Share This Page