Recall & Review
beginner
What does HSTS stand for and what is its main purpose?
HSTS stands for HTTP Strict Transport Security. Its main purpose is to tell browsers to only connect to a website using HTTPS, improving security by preventing insecure HTTP connections.
Click to reveal answer
beginner
How do you enable HSTS in an nginx server configuration?
You add the header
Strict-Transport-Security in the server block for HTTPS, for example: <br>add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
Click to reveal answer
beginner
What does the
max-age directive in the HSTS header control?The
max-age directive sets how long (in seconds) the browser should remember to only use HTTPS for the site. For example, max-age=31536000 means 1 year.Click to reveal answer
intermediate
What is the effect of adding
includeSubDomains in the HSTS header?Adding
includeSubDomains tells browsers to apply the HSTS policy to all subdomains of the site, not just the main domain.Click to reveal answer
intermediate
Why should the HSTS header be sent only over HTTPS connections?
Because HSTS tells browsers to only use HTTPS, sending it over HTTP would be insecure and could allow attackers to intercept or strip the header.
Click to reveal answer
What is the correct nginx directive to add the HSTS header?
✗ Incorrect
The correct nginx directive is
add_header with the full header name Strict-Transport-Security and the value including max-age and optionally includeSubDomains. The always flag ensures it is added on all responses.What does the
max-age value in the HSTS header represent?✗ Incorrect
max-age sets the time in seconds that the browser remembers to only use HTTPS for the site.Why is it important to include
includeSubDomains in the HSTS header?✗ Incorrect
Including
includeSubDomains tells browsers to enforce HTTPS on all subdomains, improving overall security.What happens if you send the HSTS header over an HTTP connection?
✗ Incorrect
Sending HSTS over HTTP is insecure because attackers can intercept or remove the header, defeating its purpose.
Which of these is a valid HSTS header value?
✗ Incorrect
The value must use seconds for max-age and can include
includeSubDomains. "one year" is invalid, and excludeSubDomains is not a valid directive.Explain how to configure the HSTS header in nginx and why it is important.
Think about telling browsers to always use HTTPS and how nginx sends headers.
You got /5 concepts.
Describe the risks of not using HSTS on a website that supports HTTPS.
Consider what happens if browsers are allowed to connect over HTTP.
You got /4 concepts.