SSL ignored on subdomains

Posted February 23, 2015 3k views

I have an SSL certificate only for the top level domain (e.g. and have a subdomain ( that points via DNS to a blog on Tumblr.

My nginx server config looks like this:

server {
        listen 80;


    return 301$request_uri;

server {
    listen 443 ssl;
    listen [::]:443 ipv6only=on;

    ssl on;
    ssl_certificate  /etc/nginx/ssl/ssl.cer;
    ssl_certificate_key /etc/nginx/ssl/ssl.key;

    # Add perfect forward secrecy
    ssl_prefer_server_ciphers on;

    # Add HSTS
    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;



    location / {
        proxy_pass http://localhost:3001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;

My DNS record looks like this:

CNAME blog

If I try accessing then it gets redirected to the https version and there’s a Server Not Found error in my browser. Do I need to make changes to the DNS records or in Nginx?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

If you’re pointing the blog cname to tumblr it has nothing to do with your server. You probably need to register your domain somehow with tumblr.

So the problem is that I’d set the HSTS to include subdomains, this line here being the culprit:

# Add HSTS
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";

Taking out includeSubdomains means browsers don’t automatically switch to HTTPS.

If you’ve done the same and are using Chrome and want to clear your HSTS ‘cache’, type this into the url bar: