COMPUTER ENGINEER

Blog
HTTP / HTTPS / TLS6 min study
09/ 70

Methods and request semantics

301, 302, 303, 307 and 308

Redirects can change the method.

UnderstandStudy an examplePractise

Understand the concept

Location supplies another address. 301 is permanent and 302 temporary; historical client behaviour may change POST to GET. 307 and 308 preserve method and body. 303 supports retrieving a different resource after an operation.

Post/Redirect/Get reduces accidental form resubmission on refresh but does not replace duplicate-operation controls. Know the client redirect policy. Cross-origin redirects can restrict credentials and sensitive headers.

Chains add latency, and incorrect scheme information can create loops. Unvalidated returnUrl values create open redirects; validate local destinations or an allowlist. Permanent redirects can be cached and difficult to undo.

WHEN TO USE IT

For login returns, form flows and HTTPS migrations.

COMMON PITFALL

Choosing 302 when a POST must be preserved.

01 / PRACTICE

One topic. Three levels of depth.

HTTP / illustrative example
HTTP/1.1 301 Moved Permanently
Location: https://example.test/blog

A permanent URL move.

This page does not send requests to external servers. Messages are readable HTTP/1.1 illustrations, not HTTP/2 or HTTP/3 wire dumps. example.test is reserved for examples. Run commands and JavaScript only in your own test environment; never publish real tokens or cookies.

02 / YOUR TURN

Try it yourself first.

Which temporary redirect explicitly preserves PUT?

Show the solution and explanation
Worked solution
307 Temporary Redirect

307 preserves method and body; destination trust remains a separate concern.