How to enable HTTP Strict-Transport-Security (HSTS) for a domain on the Plesk server?




  • Avatar
    Jayden Pearse (Edited )

    I'm not sure the answer is correct...

    Following these steps above meant that the http webpage would 301 redirect to the https webpage which would 301 redirect to itself ad infinitum. Removing the return 301 https://$host$request_uri; line made it work correctly for me. These are the steps I followed to make it work correctly:

    1. Enable Permanent SEO-safe 301 redirect from HTTP to HTTPS in Plesk > Domains > >Hosting Settings.
    2. Go to Plesk > Domains > > Apache & nginx Settings and insert the following Additional nginx directives:

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";

  • Avatar
    Artyom Baranov

    @Jayden Pearse

    Hello! Thanks for noticing that. I have updated the article.

  • Avatar

    Hi Yulia,

    I was invited to comment on your article

    According the RFC6797 ( we should NOT send this when the connection is plain http.
    The exact reasons for this are beyond my paygrade.

    In that thread I describe how to accomplish this.

  • Avatar


    The "always" parameter should be examined too.
    Some sites were unable to detect the header until I added the extra parameter "always"

    The "includeSubdomains" should be used with caution. It is quite easy to overlook the usage of some subdomains.

    If enabled, the parameter "preload" should be considered.


  • Avatar
    Bulat Tsydenov

    @frater, Hi! Thanks for your input! The article was modified accordingly. If you think that something is missed here, please let us know.

Please sign in to leave a comment.

Have more questions? Submit a request