---
title: "Discussion on \"HSTS Header (Strict Transport Security) Explained\" | Hashnode"
description: "Discussion on \"HSTS Header (Strict Transport Security) Explained\". Learn why HTTPS is not enough to protect your website from network attacks and how the HSTS header comes in to solve the problem."
url: "https://hashnode.com/posts/hsts-header-strict-transport-security-explained/60436a168458d42fc821b01a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [HSTS Header (Strict Transport Security) Explained](https://appsecmonkey.hashnode.dev/hsts-header-strict-transport-security-explained?utm_source=hashnode&utm_medium=feed)

Learn why HTTPS is not enough to protect your website from network attacks and how the HSTS header comes in to solve the problem.

Mar 6, 2021 · 10 min read · appsecmonkey.hashnode.dev  
Read the article

-   [#web-development](https://hashnode.com/tag/web-development)
-   [#programming](https://hashnode.com/tag/programming)
-   [#security](https://hashnode.com/tag/security)
-   [#cybersecurity-1](https://hashnode.com/tag/cybersecurity-1)

## Written by

[Teo Selenius](https://hashnode.com/@teoselenius)

@teoselenius

  
[View profile](https://hashnode.com/@teoselenius)

OSCP, OSCE, OSWE, CKS

## Responses 1

Markdown supported · ⌘↵ to post

[mahesh sabharwal](https://hashnode.com/@maheshs)

[Mar 18, 2021](https://hashnode.com/posts/hsts-header-strict-transport-security-explained/60436a168458d42fc821b01a/comment/60534121b22fc610f73bf6d3)

Thanks for the article. But this article as well as others I have seen on the web - miss out one critical thing - where do I add these directives?

You mention that add this directive -

`Strict-Transport-Security: max-age=60`

**Ya, but where?**

I am using Ubuntu 16.04 with Apache, MySQL and PHP.

[Teo Selenius](https://hashnode.com/@teoselenius)

[Mar 21, 2021](https://hashnode.com/posts/hsts-header-strict-transport-security-explained/60436a168458d42fc821b01a/comment/60534121b22fc610f73bf6d3#reply-6056d61b63a05a21443f2b3b)

Hey! It doesn't really matter how and where you set the header, as long as it is correctly returned to the web browser.

If you're using Apache, you can use mod\_headers like so:

Header set Strict-Transport-Security "options"

[httpd.apache.org/docs/current/mod/mod\_headers.html](https://httpd.apache.org/docs/current/mod/mod_headers.html)

Not really related to HSTS, but since you are already using Apache then check out ModSecurity and the OWASP Core Ruleset as well, it will provide you a WAF (Web Application Firewall) capability to your Apache server and protect your PHP application from most obviously malicious input.

[owasp.org/www-project-modsecurity-core-rule-set](https://owasp.org/www-project-modsecurity-core-rule-set/)
