{"record":{"id":"f3602a20a63cd0ed","repo":"kataras/iris","slug":"autotls-use-iris-autotlsnoredirect-instead","errorCode":null,"errorMessage":"autotls: use iris.AutoTLSNoRedirect instead","messagePattern":"autotls: use iris\\.AutoTLSNoRedirect instead","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/host/supervisor.go","lineNumber":411,"sourceCode":"\t\t\treturn http1Handler\n\t\t}\n\t}\n\n\tif challengeHandler != nil {\n\t\thttp1Server := &http.Server{\n\t\t\tAddr:              \":http\",\n\t\t\tHandler:           challengeHandler(nil), // nil for redirection.\n\t\t\tReadTimeout:       su.Server.ReadTimeout,\n\t\t\tReadHeaderTimeout: su.Server.ReadHeaderTimeout,\n\t\t\tWriteTimeout:      su.Server.WriteTimeout,\n\t\t\tIdleTimeout:       su.Server.IdleTimeout,\n\t\t\tMaxHeaderBytes:    su.Server.MaxHeaderBytes,\n\t\t}\n\n\t\tif su.Fallback == nil {\n\t\t\tif !su.manuallyTLS && su.disableHTTP1ToHTTP2Redirection {\n\t\t\t\t// automatic redirection was disabled but Fallback was not registered.\n\t\t\t\treturn fmt.Errorf(\"autotls: use iris.AutoTLSNoRedirect instead\")\n\t\t\t}\n\t\t\tgo http1Server.ListenAndServe()\n\t\t} else {\n\t\t\t// if it's manual TLS still can have its own Fallback server here,\n\t\t\t// the handler will be the redirect one, the difference is that it can run on any port.\n\t\t\tsrv := su.Fallback(challengeHandler)\n\t\t\tif srv == nil {\n\t\t\t\tif !su.manuallyTLS {\n\t\t\t\t\treturn fmt.Errorf(\"autotls: relies on an HTTP/1.1 server\")\n\t\t\t\t}\n\t\t\t\t// for any case the end-developer decided to return nil here,\n\t\t\t\t// we proceed with the automatic redirection.\n\t\t\t\tsrv = http1Server\n\t\t\t\tgo srv.ListenAndServe()\n\t\t\t} else {\n\t\t\t\tif srv.Addr == \"\" {\n\t\t\t\t\tsrv.Addr = \":http\"\n\t\t\t\t}","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/core/host/supervisor.go#L393-L429","documentation":"When running automatic TLS, the supervisor starts a fallback HTTP/1.1 server for HTTP->HTTPS (ACME challenge / HTTP2) redirection. If redirection was explicitly disabled (AutoTLSNoRedirect) but no Fallback was registered, the supervisor cannot operate and returns this error.","triggerScenarios":"Calling ListenAndServeAutoTLS after setting iris.AutoTLSNoRedirect (supervisor.disableHTTP1ToHTTP2Redirection) without providing a Fallback server via su.Fallback / configuration.","commonSituations":"Disabling redirection to avoid extra listeners but forgetting the fallback; copy-pasting AutoTLSNoRedirect option from docs without setting up a custom challenge handler.","solutions":["Remove the AutoTLSNoRedirect option so the automatic HTTP->HTTPS redirection server is used.","Register a Fallback server for the supervisor (host.Supervisor.Fallback or the configuration that supplies it) that serves the ACME challenge.","If redirection is truly unwanted and no fallback is needed, run a plain ListenAndServeTLS with your own certificates instead of AutoTLS."],"exampleFix":"// before\napp.Run(iris.AutoTLS(\":443\", \"example.com\", \"mail@example.com\"), iris.WithAutoTLSNoRedirect())\n// after\napp.Run(iris.AutoTLS(\":443\", \"example.com\", \"mail@example.com\")) // allow automatic redirection\n","handlingStrategy":"validation","validationCode":"if disableRedirect && fallbackServer == nil {\n    return errors.New(\"AutoTLSNoRedirect requires a registered Fallback server\")\n}","typeGuard":null,"tryCatchPattern":"err := app.Run(iris.AutoTLS(\":443\", domain, email))\nif err != nil && strings.Contains(err.Error(), \"AutoTLSNoRedirect\") {\n    // reconfigure: remove the NoRedirect option or register a Fallback\n}","preventionTips":["Only set AutoTLSNoRedirect when you register your own Fallback/challenge server","Prefer default AutoTLS behavior unless you need custom redirection","Test TLS startup in staging before production"],"tags":["autotls","tls","configuration"],"backgroundTag":"autotls-redirect-misconfigured","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}