{"record":{"id":"d30ee22be0c17dae","repo":"caddyserver/caddy","slug":"server-listening-on-v-is-configured-for-http-and","errorCode":null,"errorMessage":"server listening on %v is configured for HTTP and cannot natively multiplex HTTP and HTTPS: %s","messagePattern":"server listening on (.+?) is configured for HTTP and cannot natively multiplex HTTP and HTTPS: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"caddyconfig/httpcaddyfile/httptype.go","lineNumber":1168,"sourceCode":"\t\tif httpOrHTTPS == \"HTTPS\" {\n\t\t\terrMsg := fmt.Errorf(\"server listening on %v is configured for HTTPS and cannot natively multiplex HTTP and HTTPS: %s\",\n\t\t\t\tsrv.Listen, addr.Original)\n\t\t\tif addr.Scheme == \"\" && addr.Host == \"\" {\n\t\t\t\terrMsg = fmt.Errorf(\"%s (try specifying https:// in the address)\", errMsg)\n\t\t\t}\n\t\t\treturn errMsg\n\t\t}\n\t\tif len(srv.TLSConnPolicies) > 0 {\n\t\t\t// any connection policies created for an HTTP server\n\t\t\t// is a logical conflict, as it would enable HTTPS\n\t\t\treturn fmt.Errorf(\"server listening on %v is HTTP, but attempts to configure TLS connection policies\", srv.Listen)\n\t\t}\n\t\thttpOrHTTPS = \"HTTP\"\n\t\treturn nil\n\t}\n\tcheckAndSetHTTPS := func(addr Address) error {\n\t\tif httpOrHTTPS == \"HTTP\" {\n\t\t\treturn fmt.Errorf(\"server listening on %v is configured for HTTP and cannot natively multiplex HTTP and HTTPS: %s\",\n\t\t\t\tsrv.Listen, addr.Original)\n\t\t}\n\t\thttpOrHTTPS = \"HTTPS\"\n\t\treturn nil\n\t}\n\n\tfor _, sblock := range serverBlocks {\n\t\tfor _, addr := range sblock.parsedKeys {\n\t\t\tif addr.Scheme == \"http\" || addr.Port == httpPort {\n\t\t\t\tif err := checkAndSetHTTP(addr); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else if addr.Scheme == \"https\" || addr.Port == httpsPort || len(srv.TLSConnPolicies) > 0 {\n\t\t\t\tif err := checkAndSetHTTPS(addr); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else if addr.Host == \"\" {\n\t\t\t\tif err := checkAndSetHTTP(addr); err != nil {","sourceCodeStart":1150,"sourceCodeEnd":1186,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/caddyconfig/httpcaddyfile/httptype.go#L1150-L1186","documentation":"Mirror of error 122 from the HTTPS side: the server was already classified as HTTPS (a prior address was https), and a subsequent address resolves to HTTP (`http://` scheme or the configured http_port). One listener cannot serve both protocols, so adaptation fails.","triggerScenarios":"A server whose first site key is `https://example.com` followed by another key/block on the same listener with `http://` scheme or a port equal to `http_port` — e.g. `https://example.com:80` after `https://example.com`, or `http://foo.example.com` sharing the https port via matching listener addresses.","commonSituations":"Forcing `http://` on the HTTPS port to dodge automatic HTTPS, or merging two previously separate site files into one server where one used TLS and one did not.","solutions":["Move the http:// site to the HTTP port (default :80)","Change the http:// address to https://","Separate the sites with explicit `bind` or distinct ports so they form different servers"],"exampleFix":"# before\nhttps://example.com {\n  respond \"tls\"\n}\nhttp://api.example.com:443 {\n  respond \"api\"\n}\n# after\nhttps://example.com {\n  respond \"tls\"\n}\nhttp://api.example.com:80 {\n  respond \"api\"\n}","handlingStrategy":"validation","validationCode":"# Mirror of 122: one scheme per listener group\nfor group in group_addresses_by_listener(all_keys):\n    schemes = {infer_scheme(a) for a in group}\n    assert len(schemes) == 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give http:// sites the dedicated HTTP port","Do not use http:// on 443 to disable auto-HTTPS; use auto_https off instead","Validate with caddy adapt before reload"],"tags":["caddy","caddyfile","http","https","listening"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}