Glossary
HTTP redirect: when the server says go elsewhere
An HTTP redirect is a response with a 3xx status and a Location header that tells the client to request a different URL instead.
The redirect codes
| Code | Name | Method on the next request | Typical use |
|---|---|---|---|
| 301 | Moved Permanently | Clients may switch POST to GET | Old URL to new URL, http to https |
| 302 | Found | Clients may switch POST to GET | Temporary moves, login gates |
| 303 | See Other | Always GET | After a form post, to a result page |
| 307 | Temporary Redirect | Same method and body | Temporary move that must keep POST |
| 308 | Permanent Redirect | Same method and body | Permanent move that must keep POST |
Pages can also redirect without a 3xx status, through a meta refresh tag or JavaScript that sets window.location. HTTP clients do not follow those; browsers do, which is one reason JavaScript rendering matters.
How clients follow them
Most HTTP libraries follow redirects by default up to a limit (Requests allows 30, for example) and expose the chain, so you can see each hop. The Fetch API follows automatically unless you set redirect: "manual". Browsers follow everything, including JavaScript redirects. Cookies set on intermediate hops are kept by clients that maintain a cookie jar, which matters because many sites set a session cookie on the first hop and expect it on the next.
Redirects that lead to a challenge
Bot protection often uses a redirect to move a suspicious visitor to a check. Common shapes:
- A 302 from the product page to a URL containing a challenge path or a
captchaparameter. - A JavaScript redirect to an interstitial page that runs a script, sets a cookie and sends the visitor back.
- Search engines sending a flagged query to an "unusual traffic" page with a reCAPTCHA (see SERP).
- DataDome style blocks that respond with a page pointing to a captcha URL you must load (see DataDome).
Watch the redirect chain in your logs. If the final URL is not the one you asked for, check whether it is a challenge before parsing. For a DataDome block, the captcha URL from that page goes into a DataDome Slider task, which returns a datadome cookie to set before retrying the original URL. Return to the original target once the check is passed; the challenge page itself has nothing to scrape.
Redirect loops
A loop happens when the server keeps sending you between two URLs, often because a required cookie is never stored or sent. Typical causes are a client without a cookie jar, a cookie set for a different domain than the one you call, or a clearance cookie used from a different IP than the one that earned it. Set a hop limit, log the chain, and compare it with a browser session to see which cookie is missing (see cookie).
Redirects after solving
After you submit a solved token, a successful form usually answers with 302 or 303 to the next page. Treat that redirect as the success signal; if the form re-renders with the widget again instead, the token was rejected or expired. Tokens last about two minutes, so submit soon after the task returns.
Common questions
What is the difference between 302 and 307?
Both are temporary. With 302 clients may switch POST to GET; with 307 they must repeat the same method and body.
Do HTTP libraries follow JavaScript redirects?
No. Only browsers run the script. HTTP clients follow 3xx responses with a Location header.
Why do I end up in a redirect loop?
Usually a required cookie is not stored or sent, for example because the client has no cookie jar.
How can I tell a redirect led to a challenge?
Compare the final URL with the one you requested and look for challenge paths, parameters or widgets in the page.
What redirect follows a successful token submission?
Often a 302 or 303 to the next page. Seeing the form again usually means the token was rejected.
Keep reading
- HTTP status codeThe three digit codes servers answer with, and what 200, 301, 403, 429 and 503 usually mean for a scraper.
- CookieSmall values a site stores in the client, which carry sessions and the clearance proof issued after a passed challenge.
- Challenge pageInterstitial pages that run checks before the real content loads, the status codes they return, and how to detect one.
- DataDome Slider solver$1.75 per 1,000 tasks, answers under 10 seconds.