An HTTP response contains the header 'Location: https://new-site.example.com/page' along with a 302 status code. What will the browser do?
- A.Cache the redirect response (assuming permanence): skip the origin entirely on future visits
- B.Automatically make a new GET request to https://new-site.example.com/page (temporary redirect)
- C.Show a security warning dialog (flagging a possible open redirect): require explicit user confirmation before proceeding
- D.Re-send the original method to the new Location (preserving the POST body): a common resubmission behavior
Why B is correct
A 302 Found response with a Location header tells the browser to temporarily redirect to the specified URL. The browser follows it with a GET. Unlike 301 (permanent), 302 should not be cached permanently. POST-Redirect-GET uses 303 See Other to prevent form resubmission.
Know someone studying for Web App Fundamentals? Send them this one.