# error: net/http: stopped after 10 redirects

- **ID:** `go/net-http-client-does-not-follow-redirects`
- **Domain:** go
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The HTTP client stopped following redirects after reaching the default maximum of 10 redirects, often due to a redirect loop.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## Workarounds

1. **Set a custom CheckRedirect function to limit and log redirects** (90% success)
   ```
   client := &http.Client{
    CheckRedirect: func(req *http.Request, via []*http.Request) error {
        if len(via) >= 5 { return http.ErrUseLastResponse }
        return nil
    },
}
   ```

## Dead Ends

- **Increasing CheckRedirect limit without fixing loop** — May cause infinite loop; fix the redirect logic. (60% fail)
