nginx-proxy-manager/backend/schema/components/error-object.json
Tom Winnerl abcf0af67c i18n(locations): translatable location check messages
The state of a custom location (location editor, save warning, host
status popover) showed the backend's English sentence in every language.

Backend: every entry of meta.nginx_locations now has a stable `code`
(empty_path, empty_host, invalid_host, invalid_path, unbalanced_braces,
regex_forward_path, named_forward_path, unresolved, rejected, omitted)
and `params` (`host` for unresolved, nginx's error as `detail` for
rejected and omitted, a sentence of its own like a host-level error's
detail) next to the English `message`, which stays for API users and
logs. An unsafe location value names its field (location_path,
location_forward_host, location_forward_path) like the host's own. OpenAPI schema, docs, unit tests and the Cypress spec
cover the new fields.

Frontend: the text comes from location-check.<code> (en, de, et, vi;
invalid_path and rejected reuse location.error.path-invalid and
location-status.quarantined.default), nginx's own error is shown below
it untranslated. An unknown code shows the backend's message.

The English plurals of "+{count} locations", "{count} problems" and the
two save warnings use `=1 {...}`, so languages without a "one" category
(ja, zh, ko, id) that fall back to English read "1 location", not
"1 locations".

A host rejected because of a custom location ('Custom location "/api"
advanced configuration: ... (line 2).') is worded by describeNginxError()
from the details' area (location, location_advanced), location_path and
relative_line: nginx-error.location and
nginx-error.location-advanced-line (en, de, et, vi), nginx's error below
it untranslated. The hint of the regex/named forward path rule follows
its new English text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:03:56 +01:00

99 lines
2.8 KiB
JSON

{
"type": "object",
"description": "Error object",
"additionalProperties": false,
"required": ["code", "message"],
"properties": {
"code": {
"type": "integer",
"example": 400
},
"message": {
"type": "string",
"example": "Bad Request"
},
"message_i18n": {
"type": "string",
"description": "Translation key for the message, when one exists",
"example": "error.invalid-auth"
},
"details": {
"type": "object",
"description": "Structured details for some errors. Nginx configuration errors use kind \"nginx_config\".",
"additionalProperties": true,
"properties": {
"kind": {
"type": "string",
"example": "nginx_config"
},
"scope": {
"type": "string",
"enum": ["location", "host", "other_host", "global"],
"example": "host"
},
"host_type": {
"type": ["string", "null"],
"example": "proxy_host"
},
"host_id": {
"type": ["integer", "null"],
"example": 12
},
"file": {
"type": ["string", "null"],
"example": "/data/nginx/proxy_host/12.conf"
},
"line": {
"type": ["integer", "null"],
"example": 31
},
"location_index": {
"type": ["integer", "null"],
"example": null
},
"location_path": {
"type": ["string", "null"],
"example": null
},
"nginx_output": {
"type": ["string", "null"],
"example": "nginx: [emerg] unknown directive \"proxy_passs\" in /data/nginx/proxy_host/12.conf:31"
},
"hint": {
"type": ["string", "null"],
"example": "Check the spelling of the directive."
},
"hint_code": {
"type": ["string", "null"],
"description": "Names the hint, for clients that word it in their own language",
"example": "unknown_directive"
},
"area": {
"type": ["string", "null"],
"description": "Part of the host's config the error is in: host_advanced, location (location_index/location_path) or location_advanced",
"example": "host_advanced"
},
"relative_line": {
"type": ["integer", "null"],
"description": "Line within that area, eg. of the advanced configuration",
"example": 3
},
"reason": {
"type": "string",
"description": "Set for special cases: conflict, regenerated_conflict, too_many_broken_hosts, redacted",
"example": "conflict"
},
"detail": {
"type": ["string", "null"],
"description": "The humanised nginx error on its own, for clients that word the rest of the message themselves. kind unsafe_value: the rejected value, quoted",
"example": "Unknown directive \"proxy_passs\"."
},
"field": {
"type": ["string", "null"],
"description": "kind unsafe_value: which value can't be written into nginx config, eg. forward_host",
"example": "forward_host"
}
}
}
}
}