Your site must redirect all HTTP traffic to HTTPS. How do you do it?
BeginnerScenarioTLS, HTTP & Application Layer
Answer
Situation read → A simple but common task, with a security extra.
What I'd do →
- On the ALB add a listener on port 80 with a redirect action to HTTPS 443 and status HTTP_301
- On Nginx use
server { listen 80; return 301 https://$host$request_uri; } - Add HSTS on the HTTPS side:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; - Test with
curl -sI http://example.com
Why → A redirect protects the first request; HSTS makes browsers skip HTTP afterward.
Interview tip → Say you start HSTS with a short max-age before enabling preload.
More on TLS, HTTP & Application Layer
Explain what happens in a TLS 1.3 handshake in a few sentences.BeginnerWhat is the difference between 4xx and 5xx errors, and which ones do you see most in networking problems?BeginnerHTTP/1.1, HTTP/2 and HTTP/3: what changed and why does it matter in operations?BeginnerThe browser console shows a CORS error when your frontend calls your API. What is it and how do you fix it?BeginnerHow do you check which certificate a server presents and when it expires?BeginnerWhat is the difference between HTTP keep-alive and a new TCP connection per request?Beginner