{"record":{"id":"03f6e19af8264984","repo":"caddyserver/caddy","slug":"paths-are-not-allowed-s","errorCode":null,"errorMessage":"paths are not allowed: %s","messagePattern":"paths are not allowed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/reverseproxy/command.go","lineNumber":115,"sourceCode":"\n\thttpPort := strconv.Itoa(caddyhttp.DefaultHTTPPort)\n\thttpsPort := strconv.Itoa(caddyhttp.DefaultHTTPSPort)\n\n\tto, err := fs.GetStringSlice(\"to\")\n\tif err != nil {\n\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"invalid to flag: %v\", err)\n\t}\n\tif len(to) == 0 {\n\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"--to is required\")\n\t}\n\n\t// set up the downstream address; assume missing information from given parts\n\tfromAddr, err := httpcaddyfile.ParseAddress(from)\n\tif err != nil {\n\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"invalid downstream address %s: %v\", from, err)\n\t}\n\tif fromAddr.Path != \"\" {\n\t\treturn caddy.ExitCodeFailedStartup, fmt.Errorf(\"paths are not allowed: %s\", from)\n\t}\n\tif fromAddr.Scheme == \"\" {\n\t\tif fromAddr.Port == httpPort || fromAddr.Host == \"\" {\n\t\t\tfromAddr.Scheme = \"http\"\n\t\t} else {\n\t\t\tfromAddr.Scheme = \"https\"\n\t\t}\n\t}\n\tif fromAddr.Port == \"\" {\n\t\tswitch fromAddr.Scheme {\n\t\tcase \"http\":\n\t\t\tfromAddr.Port = httpPort\n\t\tcase \"https\":\n\t\t\tfromAddr.Port = httpsPort\n\t\t}\n\t}\n\n\t// set up the upstream address; assume missing information from given parts","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/reverseproxy/command.go#L97-L133","documentation":"The --from address parsed but contains a path component. The reverse-proxy quick command builds a site address, and paths are not permitted in the downstream listener address (routing on paths is a config-file concern, not a CLI flag).","triggerScenarios":"'caddy reverse-proxy --from example.com/api ...' — any --from value with a '/' after the host.","commonSituations":"Trying to scope the proxy to a path prefix using the flag, mirroring how one might write it in a Caddyfile site block.","solutions":["Remove the path from --from: 'caddy reverse-proxy --from example.com --to localhost:8080'.","If path-scoped proxying is needed, write a Caddyfile with 'handle_path /api/*' or matchers instead of the quick command.","Use 'caddy adapt' on that Caddyfile to inspect the resulting JSON."],"exampleFix":"# before\ncaddy reverse-proxy --from example.com/api --to localhost:8080\n\n# after (path-scoped)\n# Caddyfile: example.com { handle_path /api/* { reverse_proxy localhost:8080 } }","handlingStrategy":"validation","validationCode":"a, err := httpcaddyfile.ParseAddress(from)\nif err != nil {\n    return err\n}\nif a.Path != \"\" {\n    return fmt.Errorf(\"--from %q must not contain a path; use a Caddyfile for path matching\", from)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reserve path-based routing for Caddyfile matchers/handle blocks.","Treat --from strictly as a listener address.","Migrate to a config file once routing rules beyond host-level are needed."],"tags":["cli","reverse-proxy","address-parsing","startup"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}