Infrastructure & Ops · 8 min read · Intermediate
HTTPS, TLS & Essential HTTP Security Headers
Encrypt traffic in transit and harden Nginx/API responses with HSTS, X-Content-Type-Options, and X-Frame-Options.
What you'll learn
- Understand how TLS ensures confidentiality, integrity, and server identity
- Prevent clickjacking with `X-Frame-Options` / CSP `frame-ancestors`
- Stop MIME-sniffing attacks with `X-Content-Type-Options: nosniff`
Overview
Encrypt traffic in transit and harden Nginx/API responses with HSTS, X-Content-Type-Options, and X-Frame-Options.
Code Example
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
Key Takeaways
- Understand how TLS ensures confidentiality, integrity, and server identity
- Prevent clickjacking with
X-Frame-Options/ CSPframe-ancestors - Stop MIME-sniffing attacks with
X-Content-Type-Options: nosniff
Quick Check
Check Your Understanding
Score: 0 / 1
1. What attack does `X-Frame-Options: SAMEORIGIN` (or CSP `frame-ancestors 'self'`) defend against?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.