Plesk for Windows
Plesk for Linux
kb: how-to
ABT: Group B
Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to enable/disable HTTP Strict-Transport-Security (HSTS) for a domain in Plesk?
Answer
Note: A valid SSL certificate must be installed on the website, otherwise it'll not be accessible.
-
Install SSL It! extension in Extensions
-
Navigate to Domains > example.com > Hosting Settings and make sure SSL/TLS support is enabled
-
Navigate to Domains > example.com > SSL/TLS Certificates
-
Click on the HSTS button:
-
Configure the HSTS options and click on Enable (or Disable) HSTS:
Comments
13 comments
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 > example.com >Hosting Settings.
2. Go to Plesk > Domains > example.com > Apache & nginx Settings and insert the following Additional nginx directives:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
@Jayden Pearse
Hello! Thanks for noticing that. I have updated the article.
Hi Yulia,
I was invited to comment on your article
https://talk.plesk.com/threads/hsts-and-ssl-conf-command.345644/#post-838086
According the RFC6797 (https://tools.ietf.org/html/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.
PS...
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.
https://hstspreload.org/
@frater, Hi! Thanks for your input! The article was modified accordingly. If you think that something is missed here, please let us know.
The UserVoice idea has been implemented now and this functionality is supported in the SSL It! extension. Could you please update this article accordingly?
@Dennis Am, thanks for letting us know! I've updated the article to show that it's now available as a part of SSL It! extension
Just enabled hsts on my 100asa.it domain, but ceck on https://hstspreload.org/?domain=100asa.it say me: Error: No preload directive
Where I can add this directive?
@Remigio Ruberto
Hi, In current implementation of HSTS feature in Plesk, it is not possible to add 'preload'. You can leave your comments and suggestions for improving this feature here:
https://plesk.uservoice.com/forums/184549-feature-suggestions/suggestions/5079332-support-for-http-strict-transport-security-hsts#{toggle_previous_statuses}
You can do it only manually by modifying the corresponding configuration file /etc/nginx/plesk.conf.d/vhosts/example.com.conf. However, you should keep in mind, that whenever you make some changes to domain settings in Plesk, you manual changes will be overwritten.
The solution perfect for my is :
1- Go to Domain> select your domain > Go to SSL > Enable Redirect from http to https
2. Go to Apache & Nginx > Additional nginx directives , Copy and paste this code:
3.- Test your website : https://hstspreload.org/
Note: Edwynn Flores Martínez solution refers to Servers running nginx, although some services may not run nginx, and use Apache solely.
It does not help when the button to press in step # 6 is dimmed out and not available. What to do now?
Hi Rick (Richard McFarland),
My website is HSTS compliance. On it, the HSTS button is clicked as OFF, and the setting is done, to the best of my understanding on the 'Apache & nginx Settings' on the 'Additional nginx directives', where you may add:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
I also have on it:
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
Possibly, some additional configuration was required to support the HSTS qualification.
Please sign in to leave a comment.