SSL ignored on subdomains

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?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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:


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.