SlideShare a Scribd company logo
1 of 4
Download to read offline
What is HSTS & How to
Implement on your
website?
Keeping your website data is probably the most important thing,
and believe me, you can’t be sure of the security with just a 301
redirect while switching from HTTP to HTTPS. The 301 redirect
still leaves a tiny window of opportunity for hackers to get inside
your home and steal your most valuable possession, the data of
your website.
That’s enough about the problem; let’s talk about the solution!
HSTS, an added level of security to your website.
But what is it really?
Also Read: How to Redirect HTTP to HTTPS in htaccess?
What is HSTS?
HSTS stands for HTTP Strict Transport Security. It is a web
server directive; In simple terms, it is a web security
policy mechanism that only enables secure connections to
access your website.
HTTPS is a secure protocol, but there is one flaw that makes it
less secure and puts your website data in danger, it is not on by
default. So, in the middle of a user not using HTTPS and you
telling them to do so, a hacker can hijack the user’s connection.
It is as bad as it sounds.
So how can an HSTS prevent this from happening?
Normally the sequence of events occurs in this pattern. A user
will want to access your website, and his connection will request
your server for access to the site. The server, being a gentleman,
will send a 301 Moved Permanently response to the browser to
tell it to redirect the HTTP address to HTTPS.
Now, the user has access to your website, so he’s happily
browsing. The problem occurs when a hacker controls the user’s
connection and can easily block the 301 response and hijack the
browsing session.
HSTS does a simple thing; with the 301 redirect request, it also
tells the browser to redirect itself to HTTPS before
responding. So, our protagonist, HSTS, saves the day by
enabling HTTPS site-wide. Now, no one can access your website
without a secure connection, and the antagonist, the Hacker, will
sit around grinding his teeth in frustration.
Another important term regarding HSTS is Preloading, but what
is it?
The preload works as a melee weapon for HSTS to secure your
website. The HSTS has one major flaw; it doesn’t work for the
very first connection a user
makes. If a user is browsing your website for the first time, there
is still a chance of hijacking and all the bad stuff we talked about
earlier. The preload prevents just that.
HSTS preloading is a Chromium project initiative. In this, the
Chromium project maintains and built-ins a list of all the HSTS-
enabled websites. When a new user browses the website, the
preload makes the connection act as if they’ve already seen the
HSTS header, securing the website completely.
You have to get your website listed in the preload list.
The obvious question now is:
How to set up HSTS?
HTTP Strict Transport Security has some requirements before it
can provide its services. They are:
1. A Valid SSL certificate.
2. Redirection of all HTTP links to HTTPS with a 301
Permanent Redirect.
3. An SSL certificate coverage of all your subdomains.
4. The Preload directive must be specified.
5. The Max-age is 31536000 seconds.
6. The includeSubDomains directive must be specified if you
have them.
Also Read: How to Install SSL on WordPress
To Turn on HSTS, you can simply add a header to all responses
of your server:
Strict-Transport-Security: max-age=300; includeSubDomains;
preload
To Install HSTS in Apache Web Server
Simply add this to your .htaccess file:
Use HTTP Strict Transport Security to force the client to use
secure connections only Header always set Strict-Transport-
Security “max-age=300; includeSubDomains; preload”
Also Read: How To Install CentOS Web Panel In CentOS
To Install HSTS in lighttpd
Simply add this to your Lighttpd configuration
file/etc/lighttpd/lighttpd.conf
server.modules += (“mod_setenv”) $HTTP[“scheme”] == “https”
{setenv.add response-header = (“Strict-Transport-Security” =>
“max-age=300; includeSubDomains; preload”)}
To Install HSTS in NGINX
Add this to your site.conf file:
add_header Strict-Transport-Security ‘max-age=300;
includeSubDomains; preload; always;’
Also Read: NGINX Explained! Know its Working & What is
it Used For?
To Install HSTS in IIS Servers
protected void Application_BeginRequest(Object sender,
EventArgs e) {switch (Request.Url.Scheme) {case “https”:
Response.AddHeader(“Strict-Transport Security”, “max-
age=31536000; includeSubDomains; preload”); break;
case “https”: var path = “https://” + Request.Url.Host =
Request.Url.PathAndQuery; Response.Status = “301 Moved
Permanently”;
Response.AddHeader(“Location”, path); break; }}
Congratulations, you’ve successfully added another security to
your website!
Source
https://www.hostitsmart.com/manage/knowledgebase/246/What
-is-HSTS-and-How-to-Implement-on-your-website.html

More Related Content

Similar to What is HSTS.pdf

Similar to What is HSTS.pdf (20)

Crypto workshop part 1 - Web and Crypto
Crypto workshop part 1 - Web and CryptoCrypto workshop part 1 - Web and Crypto
Crypto workshop part 1 - Web and Crypto
 
Learn SEO Week 4 Slides.pptx
Learn SEO Week 4 Slides.pptxLearn SEO Week 4 Slides.pptx
Learn SEO Week 4 Slides.pptx
 
Learn SEO Week 4 Slides (1).pptx
Learn SEO Week 4 Slides (1).pptxLearn SEO Week 4 Slides (1).pptx
Learn SEO Week 4 Slides (1).pptx
 
Learn SEO Week 4 Slides MORNING (1).pptx
Learn SEO Week 4 Slides MORNING (1).pptxLearn SEO Week 4 Slides MORNING (1).pptx
Learn SEO Week 4 Slides MORNING (1).pptx
 
Learn SEO Week 4 Slides MORNING.pptx
Learn SEO Week 4 Slides MORNING.pptxLearn SEO Week 4 Slides MORNING.pptx
Learn SEO Week 4 Slides MORNING.pptx
 
Learn SEO Week 4 Slides MORNING (1).pptx
Learn SEO Week 4 Slides MORNING (1).pptxLearn SEO Week 4 Slides MORNING (1).pptx
Learn SEO Week 4 Slides MORNING (1).pptx
 
Web security
Web securityWeb security
Web security
 
HTTP vs HTTPS, Do You Really Need HTTPS?
HTTP vs HTTPS, Do You Really Need HTTPS?HTTP vs HTTPS, Do You Really Need HTTPS?
HTTP vs HTTPS, Do You Really Need HTTPS?
 
OMB M 15-13, Policy to Require Secure Connections across Federal Websites and...
OMB M 15-13, Policy to Require Secure Connections across Federal Websites and...OMB M 15-13, Policy to Require Secure Connections across Federal Websites and...
OMB M 15-13, Policy to Require Secure Connections across Federal Websites and...
 
Study of http
Study of httpStudy of http
Study of http
 
Http vs https
Http vs httpsHttp vs https
Http vs https
 
Https
HttpsHttps
Https
 
HTTP & HTTPs
HTTP & HTTPsHTTP & HTTPs
HTTP & HTTPs
 
QA Fest 2016. Per Thorsheim. Website security 101
QA Fest 2016. Per Thorsheim. Website security 101QA Fest 2016. Per Thorsheim. Website security 101
QA Fest 2016. Per Thorsheim. Website security 101
 
HTTP.pptx...............................
HTTP.pptx...............................HTTP.pptx...............................
HTTP.pptx...............................
 
Protecting Web App users in today’s hostile environment
Protecting Web App users in today’s hostile environmentProtecting Web App users in today’s hostile environment
Protecting Web App users in today’s hostile environment
 
Http to Https Get your WordPress website Compliant!
Http to Https Get your WordPress website Compliant!Http to Https Get your WordPress website Compliant!
Http to Https Get your WordPress website Compliant!
 
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
HTTPS: What, Why and How (SmashingConf Freiburg, Sep 2015)
 
Geek Guide: Apache Web Servers and SSL Authentication
Geek Guide: Apache Web Servers and SSL AuthenticationGeek Guide: Apache Web Servers and SSL Authentication
Geek Guide: Apache Web Servers and SSL Authentication
 
HTTP_Header_Security.pdf
HTTP_Header_Security.pdfHTTP_Header_Security.pdf
HTTP_Header_Security.pdf
 

Recently uploaded

Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
amitlee9823
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
amitlee9823
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
Matteo Carbone
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
daisycvs
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
dlhescort
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
amitlee9823
 
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
lizamodels9
 

Recently uploaded (20)

Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
 
A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMAN
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
Uneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration PresentationUneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration Presentation
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1
 
Value Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsValue Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and pains
 
Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...Ensure the security of your HCL environment by applying the Zero Trust princi...
Ensure the security of your HCL environment by applying the Zero Trust princi...
 
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLBAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
 
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
 
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxB.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 

What is HSTS.pdf

  • 1. What is HSTS & How to Implement on your website? Keeping your website data is probably the most important thing, and believe me, you can’t be sure of the security with just a 301 redirect while switching from HTTP to HTTPS. The 301 redirect still leaves a tiny window of opportunity for hackers to get inside your home and steal your most valuable possession, the data of your website. That’s enough about the problem; let’s talk about the solution! HSTS, an added level of security to your website. But what is it really? Also Read: How to Redirect HTTP to HTTPS in htaccess? What is HSTS? HSTS stands for HTTP Strict Transport Security. It is a web server directive; In simple terms, it is a web security policy mechanism that only enables secure connections to access your website. HTTPS is a secure protocol, but there is one flaw that makes it less secure and puts your website data in danger, it is not on by default. So, in the middle of a user not using HTTPS and you telling them to do so, a hacker can hijack the user’s connection. It is as bad as it sounds. So how can an HSTS prevent this from happening? Normally the sequence of events occurs in this pattern. A user will want to access your website, and his connection will request your server for access to the site. The server, being a gentleman, will send a 301 Moved Permanently response to the browser to tell it to redirect the HTTP address to HTTPS.
  • 2. Now, the user has access to your website, so he’s happily browsing. The problem occurs when a hacker controls the user’s connection and can easily block the 301 response and hijack the browsing session. HSTS does a simple thing; with the 301 redirect request, it also tells the browser to redirect itself to HTTPS before responding. So, our protagonist, HSTS, saves the day by enabling HTTPS site-wide. Now, no one can access your website without a secure connection, and the antagonist, the Hacker, will sit around grinding his teeth in frustration. Another important term regarding HSTS is Preloading, but what is it? The preload works as a melee weapon for HSTS to secure your website. The HSTS has one major flaw; it doesn’t work for the very first connection a user makes. If a user is browsing your website for the first time, there is still a chance of hijacking and all the bad stuff we talked about earlier. The preload prevents just that. HSTS preloading is a Chromium project initiative. In this, the Chromium project maintains and built-ins a list of all the HSTS- enabled websites. When a new user browses the website, the preload makes the connection act as if they’ve already seen the HSTS header, securing the website completely. You have to get your website listed in the preload list. The obvious question now is: How to set up HSTS? HTTP Strict Transport Security has some requirements before it can provide its services. They are: 1. A Valid SSL certificate. 2. Redirection of all HTTP links to HTTPS with a 301 Permanent Redirect. 3. An SSL certificate coverage of all your subdomains. 4. The Preload directive must be specified. 5. The Max-age is 31536000 seconds. 6. The includeSubDomains directive must be specified if you have them.
  • 3. Also Read: How to Install SSL on WordPress To Turn on HSTS, you can simply add a header to all responses of your server: Strict-Transport-Security: max-age=300; includeSubDomains; preload To Install HSTS in Apache Web Server Simply add this to your .htaccess file: Use HTTP Strict Transport Security to force the client to use secure connections only Header always set Strict-Transport- Security “max-age=300; includeSubDomains; preload” Also Read: How To Install CentOS Web Panel In CentOS To Install HSTS in lighttpd Simply add this to your Lighttpd configuration file/etc/lighttpd/lighttpd.conf server.modules += (“mod_setenv”) $HTTP[“scheme”] == “https” {setenv.add response-header = (“Strict-Transport-Security” => “max-age=300; includeSubDomains; preload”)} To Install HSTS in NGINX Add this to your site.conf file: add_header Strict-Transport-Security ‘max-age=300; includeSubDomains; preload; always;’ Also Read: NGINX Explained! Know its Working & What is it Used For?
  • 4. To Install HSTS in IIS Servers protected void Application_BeginRequest(Object sender, EventArgs e) {switch (Request.Url.Scheme) {case “https”: Response.AddHeader(“Strict-Transport Security”, “max- age=31536000; includeSubDomains; preload”); break; case “https”: var path = “https://” + Request.Url.Host = Request.Url.PathAndQuery; Response.Status = “301 Moved Permanently”; Response.AddHeader(“Location”, path); break; }} Congratulations, you’ve successfully added another security to your website! Source https://www.hostitsmart.com/manage/knowledgebase/246/What -is-HSTS-and-How-to-Implement-on-your-website.html