{"record":{"id":"b3b41b6a86078ffd","repo":"caddyserver/caddy","slug":"following-http-redirects-is-not-allowed","errorCode":null,"errorMessage":"following http redirects is not allowed","messagePattern":"following http redirects is not allowed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddytls/ondemand.go","lineNumber":181,"sourceCode":"\n\tif resp.StatusCode < 200 || resp.StatusCode > 299 {\n\t\treturn fmt.Errorf(\"%s: %w %s - non-2xx status code %d\", name, ErrPermissionDenied, askEndpoint, resp.StatusCode)\n\t}\n\n\treturn nil\n}\n\n// ErrPermissionDenied is an error that should be wrapped or returned when the\n// configured permission module does not allow a certificate to be issued,\n// to distinguish that from other errors such as connection failure.\nvar ErrPermissionDenied = errors.New(\"certificate not allowed by permission module\")\n\n// These perpetual values are used for on-demand TLS.\nvar (\n\tonDemandAskClient = &http.Client{\n\t\tTimeout: 10 * time.Second,\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn fmt.Errorf(\"following http redirects is not allowed\")\n\t\t},\n\t}\n)\n\n// Interface guards\nvar (\n\t_ OnDemandPermission = (*PermissionByHTTP)(nil)\n\t_ caddy.Provisioner  = (*PermissionByHTTP)(nil)\n)\n","sourceCodeStart":163,"sourceCodeEnd":191,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddytls/ondemand.go#L163-L191","documentation":"Error \"following http redirects is not allowed\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at modules/caddytls/ondemand.go:181 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point the 'ask' endpoint directly at the final URL; redirects are not followed for safety."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}