{"record":{"id":"4ee18711d89574ec","repo":"kataras/iris","slug":"autotls-relies-on-an-http-1-1-server","errorCode":null,"errorMessage":"autotls: relies on an HTTP/1.1 server","messagePattern":"autotls: relies on an HTTP/1\\.1 server","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/host/supervisor.go","lineNumber":420,"sourceCode":"\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}\n\t\t\t\t// } else if !su.manuallyTLS && srv.Addr != \":80\" && srv.Addr != \":http\" {\n\t\t\t\t// \thostname, _, _ := net.SplitHostPort(su.Server.Addr)\n\t\t\t\t// \treturn fmt.Errorf(\"autotls: The HTTP-01 challenge relies on http://%s:80/.well-known/acme-challenge/\", hostname)\n\t\t\t\t// }\n\n\t\t\t\tif srv.Handler == nil {\n\t\t\t\t\t// handler was nil, caller wanted to change the server's options like read/write timeout.\n\t\t\t\t\tsrv.Handler = http1Server.Handler\n\t\t\t\t\tgo srv.ListenAndServe() // automatically start it, we assume the above ^","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/core/host/supervisor.go#L402-L438","documentation":"During TLS startup, if a Fallback function was registered but returns nil (and the TLS run is not manual), the supervisor has no HTTP/1.1 server to answer the ACME challenge/redirect and returns this error.","triggerScenarios":"ListenAndServeTLS/ListenAndServeAutoTLS path where su.Fallback(challengeHandler) is set but returns nil and su.manuallyTLS is false.","commonSituations":"A custom Fallback function that returns nil on error or forgets to build/return the server; conditional logic in Fallback that skips returning a server in some environments.","solutions":["Fix the Fallback function so it always returns a valid *http.Server (or non-nil) for the challenge handler.","If you intend to run manually with your own certs, set the manual TLS option so the nil fallback is tolerated.","Remove the Fallback override and let iris run the default automatic HTTP/1.1 redirect server."],"exampleFix":"// before\nsu.Fallback(func(h http.Handler) *http.Server { return nil })\n// after\nsu.Fallback(func(h http.Handler) *http.Server {\n    return &http.Server{Addr: \":80\", Handler: h}\n})","handlingStrategy":"validation","validationCode":"if su.Fallback != nil {\n    // ensure your Fallback function never returns a nil *http.Server\n}","typeGuard":null,"tryCatchPattern":"err := app.Run(iris.AutoTLS(...))\nif err != nil && strings.Contains(err.Error(), \"relies on an HTTP/1.1 server\") {\n    log.Fatal(\"custom Fallback must return a non-nil *http.Server\")\n}","preventionTips":["Always return a valid *http.Server from custom Fallback functions","Don't return nil from Fallback conditionally","Use manual TLS only when running your own cert/HTTP servers"],"tags":["autotls","tls","configuration"],"backgroundTag":"autotls-fallback-missing","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}