{"record":{"id":"f9572957670fffe5","repo":"theonedev/onedev","slug":"server-url-can-only-be-ingressurl","errorCode":null,"errorMessage":"Server URL can only be \"${ingressUrl}\"","messagePattern":"Server URL can only be \"(.+?)\"","errorType":"http","errorClass":"NotAcceptableException","httpStatus":406,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/rest/resource/SettingResource.java","lineNumber":216,"sourceCode":"\t\t\n\t@Api(order=1450)\n\t@Path(\"/contributed-settings\")\n    @GET\n    public List<ContributedAdministrationSetting> getContributedSettings() {\n    \tif (!SecurityUtils.isAdministrator()) \n\t\t\tthrow new UnauthorizedException();\n    \treturn new ArrayList<>(settingService.getContributedSettings().values());\n    }\n\t\n\t@Api(order=1500)\n\t@Path(\"/system\")\n    @POST\n    public Response setSystemSetting(@NotNull @Valid SystemSetting systemSetting) {\n    \tif (!SecurityUtils.isAdministrator()) \n\t\t\tthrow new UnauthorizedException();\n    \tString ingressUrl = OneDev.getInstance().getIngressUrl();\n    \tif (ingressUrl != null && !ingressUrl.equals(systemSetting.getServerUrl()))\n    \t\tthrow new NotAcceptableException(\"Server URL can only be \\\"\" + ingressUrl + \"\\\"\");\n    \tvar oldAuditContent = VersionedXmlDoc.fromBean(settingService.getSystemSetting()).toXML();\n    \tsettingService.saveSystemSetting(systemSetting);\n\t\tauditService.audit(null, \"changed system setting via RESTful API\", \n\t\t\t\toldAuditContent, VersionedXmlDoc.fromBean(systemSetting).toXML());\n    \treturn Response.ok().build();\n    }\n\n\t@Api(order=1600)\n\t@Path(\"/authenticator\")\n    @POST\n    public Response setAuthenticator(@Valid Authenticator authenticator) {\n    \tif (!SecurityUtils.isAdministrator()) \n\t\t\tthrow new UnauthorizedException();\n\t\tvar oldAuditContent = VersionedXmlDoc.fromBean(settingService.getAuthenticator()).toXML();\n    \tsettingService.saveAuthenticator(authenticator);\n\t\tauditService.audit(null, \"changed authenticator via RESTful API\", \n\t\t\t\toldAuditContent, VersionedXmlDoc.fromBean(authenticator).toXML());\n    \treturn Response.ok().build();","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/rest/resource/SettingResource.java#L198-L234","documentation":"setSystemSetting validates the server URL in the submitted SystemSetting: when the server runs behind a known ingress URL (e.g. in cluster mode), the URL is forced to that value and any other server URL is rejected.","triggerScenarios":"POSTing a SystemSetting whose serverUrl differs from the ingress URL derived by the server (e.g. behind a reverse proxy/ingress that fixes the external URL).","commonSituations":"Kubernetes deployments with ingress configured; changing the external URL via API while an ingress URL is enforced; trailing-slash or http/https mismatches between submitted and ingress URLs.","solutions":["Submit serverUrl exactly equal to the configured ingress URL","Remove/change the ingress URL configuration if the server URL legitimately changed","Update ingress settings in the deployment instead of the system setting"],"exampleFix":"// before\n{\"serverUrl\": \"http://old.example.com\"}\n// after\n{\"serverUrl\": \"https://onedev.example.com\"}  // must match ingress URL","handlingStrategy":"validation","validationCode":"if (ingressUrl && systemSetting.serverUrl !== ingressUrl) throw new Error('serverUrl must equal ingress URL: ' + ingressUrl);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fetch current system setting first and reuse its serverUrl","Keep ingress URL and server URL in sync in deployment config","Beware trailing-slash and http/https mismatches"],"tags":["rest-api","configuration","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}