{"record":{"id":"99a31bcbfb57d5a4","repo":"nsqio/nsq","slug":"auth-http-request-method-must-be-post-or-get","errorCode":null,"errorMessage":"--auth-http-request-method must be post or get","messagePattern":"--auth-http-request-method must be post or get","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nsqd/nsqd.go","lineNumber":139,"sourceCode":"\t}\n\n\ttlsConfig, err := buildTLSConfig(opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to build TLS config - %s\", err)\n\t}\n\tif tlsConfig == nil && opts.TLSRequired != TLSNotRequired {\n\t\treturn nil, errors.New(\"cannot require TLS client connections without TLS key and cert\")\n\t}\n\tn.tlsConfig = tlsConfig\n\n\tclientTLSConfig, err := buildClientTLSConfig(opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to build client TLS config - %s\", err)\n\t}\n\tn.clientTLSConfig = clientTLSConfig\n\n\tif opts.AuthHTTPRequestMethod != \"post\" && opts.AuthHTTPRequestMethod != \"get\" {\n\t\treturn nil, errors.New(\"--auth-http-request-method must be post or get\")\n\t}\n\n\tfor _, v := range opts.E2EProcessingLatencyPercentiles {\n\t\tif v <= 0 || v > 1 {\n\t\t\treturn nil, fmt.Errorf(\"invalid E2E processing latency percentile: %v\", v)\n\t\t}\n\t}\n\n\tn.logf(LOG_INFO, version.String(\"nsqd\"))\n\tn.logf(LOG_INFO, \"ID: %d\", opts.ID)\n\n\tn.tcpServer = &tcpServer{nsqd: n}\n\tn.tcpListener, err = net.Listen(util.TypeOfAddr(opts.TCPAddress), opts.TCPAddress)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"listen (%s) failed - %s\", opts.TCPAddress, err)\n\t}\n\tif opts.HTTPAddress != \"\" {\n\t\tn.httpListener, err = net.Listen(util.TypeOfAddr(opts.HTTPAddress), opts.HTTPAddress)","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/nsqio/nsq/blob/85cf10c09c6c3c86160d6f0eb156f62d0efc1648/nsqd/nsqd.go#L121-L157","documentation":"nsqd calls out to an external HTTP authentication endpoint when --auth-http-address is configured, using opts.AuthHTTPRequestMethod (--auth-http-request-method, default 'get'). Only the exact lowercase strings 'post' and 'get' are accepted; the check opts.AuthHTTPRequestMethod != \"post\" && != \"get\" is case-sensitive and aborts startup otherwise.","triggerScenarios":"Starting nsqd with --auth-http-request-method=POST (uppercase), 'PUT', 'DELETE', or a typo like 'GET ' with trailing whitespace. Any value other than exact 'post'/'get' fails in New() before the auth client is built.","commonSituations":"Uppercasing values in config templating (HTTP methods are conventionally uppercase, so YAML/ENV pipelines produce POST); hand-editing config files; mismatched expectations after upgrading from versions with different validation.","solutions":["Use the lowercase literal: --auth-http-request-method=post (or get, the default - then omit the flag).","Lowercase the value in whatever generates nsqd's config.","Ensure your auth endpoint actually accepts that method for the /auth path before switching."],"exampleFix":"# before\nnsqd --auth-http-address=0.0.0.0:8080 --auth-http-request-method=POST\n# after\nnsqd --auth-http-address=0.0.0.0:8080 --auth-http-request-method=post","handlingStrategy":"validation","validationCode":"if m := strings.ToLower(strings.TrimSpace(opts.AuthHTTPRequestMethod)); m != \"post\" && m != \"get\" {\n\treturn fmt.Errorf(\"invalid auth-http-request-method %q: must be post or get\", opts.AuthHTTPRequestMethod)\n}\nopts.AuthHTTPRequestMethod = m // normalize before nsqd.New","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lowercase the value in config generation pipelines - HTTP verbs are uppercase by convention and will otherwise fail.","Omit the flag entirely to keep the default 'get' unless the auth endpoint requires POST bodies."],"tags":["nsq","nsqd","cli","config","auth"],"backgroundTag":null,"analyzedSha":"85cf10c09c6c3c86160d6f0eb156f62d0efc1648","analyzedAt":"2026-08-16T00:53:05.009Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}