Learn about Centmin Mod LEMP Stack today
Become a Member

SSL Problem with subdomain redirection

Discussion in 'Domains, DNS, Email & SSL Certificates' started by Indrit, Oct 6, 2016.

  1. Indrit

    Indrit New Member

    9
    4
    3
    Jun 30, 2016
    Ratings:
    +4
    Local Time:
    5:20 PM
    Hello
    I have a small problem and i don't know if its a bug or not.
    I have just setup a ssl certificate. (example domain.com)
    the certificate is for the domain http://www.domain.com.
    I have also a subdomain http://accounts.domain.com
    When i visit the http://www.domain.com i have inserted into the conf to redirect tohttps://www.domain.com.
    The subdomain http://accounts.domain.com does not have a redirection or an active ssl certificate.
    If i visit first http://www.domain.com and then the http://accounts.domain.com the sitehttp://accounts.domain.com redirect me to https://accounts.domain.com. If i clear the cache and i go first tohttp://accounts.domain.com then the redirection does do anything (this is what i want).
    Is this a bug or a bad configuration of domain .conf?
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,161
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    12:20 AM
    Nginx 1.13.x
    MariaDB 5.5
    When you create a new nginx vhost domain via centmin.sh menu option 2 or menu option 22 or via /usr/bin/nv cli command line, you will create the Nginx vhost files and directories. You will get an outputted the path location where it will create the domain name's vhost conf file named newdomain.com.conf (and newdomain.com.ssl.conf if you selected yes to self signed SSL)
    • Nginx vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Nginx HTTP/2 SSL vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    • Nginx Self-Signed SSL Certificate Directory at /usr/local/nginx/conf/ssl/newdomain.com
    • Vhost public web root will be at /home/nginx/domains/newdomain.com/public
    • Vhost log directory will be at /home/nginx/domains/newdomain.com/log
    Please post the contents of /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf wrapped in CODE tags (outlined at How to use forum BBCODE code tags)
     
  3. eva2000

    eva2000 Administrator Staff Member

    30,161
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,136
    Local Time:
    12:20 AM
    Nginx 1.13.x
    MariaDB 5.5
    Also if you enabled HSTS headers with includeSubdomains it forces HTTP to HTTPS for main domain and all subdomains as explained here Nginx Vhost & NSD DNS Setup - CentminMod.com LEMP Nginx web stack for CentOS

     
  4. Indrit

    Indrit New Member

    9
    4
    3
    Jun 30, 2016
    Ratings:
    +4
    Local Time:
    5:20 PM
    Hello
    Thank for the tips.
    The problem was with the add_header Strict-Transport-Security.
    I disabled it and everything is working fine.
    Thank you again
     
    • Like Like x 1