Challenge - 5 Problems
HSTS Header Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the effect of this nginx HSTS header configuration?
Given this nginx configuration snippet, what will be the exact HTTP response header sent to clients?
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
Nginx
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;Attempts:
2 left
💡 Hint
Look carefully at the exact string inside the quotes in the add_header directive.
✗ Incorrect
The add_header directive sets the Strict-Transport-Security header with max-age=31536000 and includeSubDomains as specified. The 'always' flag ensures it is sent on all responses.
❓ Configuration
intermediate2:00remaining
Which nginx config disables HSTS completely?
You want to disable HSTS on your nginx server. Which configuration line will remove the Strict-Transport-Security header from responses?
Attempts:
2 left
💡 Hint
Setting max-age to zero tells browsers to stop enforcing HSTS.
✗ Incorrect
Setting max-age=0 instructs browsers to remove the HSTS policy. The other options either set an empty header or are invalid directives.
❓ Troubleshoot
advanced2:00remaining
Why is HSTS header missing despite nginx config?
You configured nginx with:
But the header is missing in HTTP responses. What is the most likely cause?
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
But the header is missing in HTTP responses. What is the most likely cause?
Attempts:
2 left
💡 Hint
HSTS only applies to secure HTTPS connections.
✗ Incorrect
HSTS headers are only sent on HTTPS responses. If the site is accessed via HTTP, nginx does not send this header.
✅ Best Practice
advanced2:00remaining
What is the recommended minimum max-age value for HSTS in production?
For strong security, what is the recommended minimum max-age value (in seconds) to set in the Strict-Transport-Security header?
Attempts:
2 left
💡 Hint
Longer max-age values enforce HSTS for longer periods.
✗ Incorrect
Security best practice recommends at least 1 year (31536000 seconds) to ensure browsers remember to only use HTTPS.
🧠 Conceptual
expert2:00remaining
What risk does missing 'includeSubDomains' in HSTS header pose?
If your nginx HSTS header is:
but does NOT include 'includeSubDomains', what is the main security risk?
Strict-Transport-Security: max-age=31536000
but does NOT include 'includeSubDomains', what is the main security risk?
Attempts:
2 left
💡 Hint
Consider how HSTS applies to subdomains when 'includeSubDomains' is missing.
✗ Incorrect
Without 'includeSubDomains', subdomains are not forced to use HTTPS, which can allow attackers to intercept traffic on those subdomains.