{"record":{"id":"253bfec6d51f2e2b","repo":"semaphoreui/semaphore","slug":"you-can-t-use-both-http-redirect-address-and-port","errorCode":null,"errorMessage":"You can't use both HTTP redirect address and port at the same time","messagePattern":"You can't use both HTTP redirect address and port at the same time","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/cmd/root.go","lineNumber":350,"sourceCode":"\n\t\t\tnext.ServeHTTP(w, r)\n\t\t})\n\t})\n\n\tvar router http.Handler = route\n\n\trouter = handlers.ProxyHeaders(router)\n\thttp.Handle(\"/\", router)\n\n\tfmt.Println(\"Server is running\")\n\n\tdefer store.Close()\n\n\tvar err error\n\tif util.Config.TLS.Enabled {\n\n\t\tif util.Config.TLS.HTTPRedirectPort != nil && util.Config.TLS.HTTPRedirectAddr != \"\" {\n\t\t\tpanic(\"You can't use both HTTP redirect address and port at the same time\")\n\t\t}\n\n\t\tvar httpRedirectAddr string\n\n\t\tif util.Config.TLS.HTTPRedirectPort != nil {\n\t\t\thttpRedirectAddr = fmt.Sprintf(\":%d\", *util.Config.TLS.HTTPRedirectPort)\n\t\t} else if util.Config.TLS.HTTPRedirectAddr != \"\" {\n\t\t\thttpRedirectAddr = util.Config.TLS.HTTPRedirectAddr\n\t\t}\n\n\t\tif httpRedirectAddr != \"\" {\n\n\t\t\tgo func() {\n\n\t\t\t\terr = http.ListenAndServe(httpRedirectAddr, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\t\t\t\ttarget := \"https://\"\n\n\t\t\t\t\tif util.Config.WebHost != \"\" {","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/cli/cmd/root.go#L332-L368","documentation":"The server startup (runService) rejects configurations that set both TLS.HTTPRedirectAddr and TLS.HTTPRedirectPort. Both control where the HTTP-to-HTTPS redirect listener binds, so specifying both is treated as a contradictory config and the process panics.","triggerScenarios":"Starting semaphore with TLS enabled and a config file that contains both `tls.http_redirect_addr: \":80\"` and a non-nil `http_redirect_port` (e.g. 80), or setting one via env var and the other via config file.","commonSituations":"Migrating old configs that used the port form while also copying a newer config snippet using the addr form; environment variables layered on top of a config file; copy-pasted example configs.","solutions":["Remove either tls.http_redirect_port or tls.http_redirect_addr from the config so only one is set","If you used an env var to set one of them (e.g. SEMAPHORE_TLS_HTTP_REDIRECT_PORT), unset it or drop the config counterpart","Keep TLS.Enabled true with exactly one redirect specification and restart"],"exampleFix":"// before (config)\ntls:\n  enabled: true\n  http_redirect_port: 80\n  http_redirect_addr: \":80\"\n// after\ntls:\n  enabled: true\n  http_redirect_addr: \":80\"","handlingStrategy":"validation","validationCode":"grep -nE 'http_redirect_(port|addr)' /etc/semaphore/config.json  # ensure at most one is set","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set only one of http_redirect_port or http_redirect_addr","Audit config plus env-var overlays for the same TLS keys","Prefer the addr form in new configs and remove legacy port fields","Validate the config with a startup smoke test in CI"],"tags":["config","tls","startup","flags"],"backgroundTag":"conflicting-config-options","analyzedSha":"1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa","analyzedAt":"2026-09-07T11:00:33.293Z","contentChangedAt":"2026-09-07T11:00:33.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}