👨💻 Software Developer @ HackSoft
👨🏼🎓 Studying Informatics @ NBU
❤️ Python & Django
domain.com
http://domain.com
http://domain.com
HTTP 200
domain.com
http://domain.com
http://domain.com
HTTP 200
domain.com
http://domain.com
http://domain.com
HTTP 200
301 Moved Permanently
# settings.py
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
domain.com
http://domain.com
https://domain.com
HTTP 301
domain.com
http://domain.com
https://domain.com
HTTP 301
Django’s warning security.W004 even says:
… enabling HSTS carelessly can cause serious, irreversible problems
Django’s warning security.W004 even says:
… enabling HSTS carelessly can cause serious, irreversible problems
# settings.py
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = True
SECURE_HSTS_SECONDS = 31536000 # 1 year
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
domain.com
https://domain.com
HTTP 200
Check HSTS registry for domain.com
http(s)://domain.com
HSTS | 301 Redirect |
---|
HSTS | 301 Redirect | |
---|---|---|
Designed for | Security | URL Redirection |
HSTS | 301 Redirect | |
---|---|---|
Designed for | Security | URL Redirection |
Covers | The entire domain | A specific URL |
HSTS | 301 Redirect | |
---|---|---|
Designed for | Security | URL Redirection |
Covers | The entire domain | A specific URL |
Cache | Separate | Browser |
HSTS | 301 Redirect | |
---|---|---|
Designed for | Security | URL Redirection |
Covers | The entire domain | A specific URL |
Cache | Separate | Browser |
Max-age | Years | Weeks/months |
If the domain is not present in the HSTS registry, a single HTTP request should be made in order to cache the domain in order to perform HTTPS-only requests in the future.
If the domain is not present in the HSTS registry, a single HTTP request should be made in order to cache the domain in order to perform HTTPS-only requests in the future.
HTTPS requests can still be decrypted by the attacker, but he needs to be a lot more sophisticated in order to achieve that.