theonedev/onedev · error · NotAcceptableException

Server URL can only be "${ingressUrl}"

Error message

Server URL can only be "${ingressUrl}"

What it means

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.

Source

Thrown at server-core/src/main/java/io/onedev/server/rest/resource/SettingResource.java:216

		
	@Api(order=1450)
	@Path("/contributed-settings")
    @GET
    public List<ContributedAdministrationSetting> getContributedSettings() {
    	if (!SecurityUtils.isAdministrator()) 
			throw new UnauthorizedException();
    	return new ArrayList<>(settingService.getContributedSettings().values());
    }
	
	@Api(order=1500)
	@Path("/system")
    @POST
    public Response setSystemSetting(@NotNull @Valid SystemSetting systemSetting) {
    	if (!SecurityUtils.isAdministrator()) 
			throw new UnauthorizedException();
    	String ingressUrl = OneDev.getInstance().getIngressUrl();
    	if (ingressUrl != null && !ingressUrl.equals(systemSetting.getServerUrl()))
    		throw new NotAcceptableException("Server URL can only be \"" + ingressUrl + "\"");
    	var oldAuditContent = VersionedXmlDoc.fromBean(settingService.getSystemSetting()).toXML();
    	settingService.saveSystemSetting(systemSetting);
		auditService.audit(null, "changed system setting via RESTful API", 
				oldAuditContent, VersionedXmlDoc.fromBean(systemSetting).toXML());
    	return Response.ok().build();
    }

	@Api(order=1600)
	@Path("/authenticator")
    @POST
    public Response setAuthenticator(@Valid Authenticator authenticator) {
    	if (!SecurityUtils.isAdministrator()) 
			throw new UnauthorizedException();
		var oldAuditContent = VersionedXmlDoc.fromBean(settingService.getAuthenticator()).toXML();
    	settingService.saveAuthenticator(authenticator);
		auditService.audit(null, "changed authenticator via RESTful API", 
				oldAuditContent, VersionedXmlDoc.fromBean(authenticator).toXML());
    	return Response.ok().build();

View on GitHub (pinned to d44925c47c)

Solutions

  1. Submit serverUrl exactly equal to the configured ingress URL
  2. Remove/change the ingress URL configuration if the server URL legitimately changed
  3. Update ingress settings in the deployment instead of the system setting

Example fix

// before
{"serverUrl": "http://old.example.com"}
// after
{"serverUrl": "https://onedev.example.com"}  // must match ingress URL
Defensive patterns

Strategy: validation

Validate before calling

if (ingressUrl && systemSetting.serverUrl !== ingressUrl) throw new Error('serverUrl must equal ingress URL: ' + ingressUrl);

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/f9572957670fffe5. Report an issue: GitHub.