nginx-proxy-manager/backend/schema/components/proxy-host-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

266 lines
6.2 KiB
JSON

{
"type": "object",
"description": "Proxy Host object",
"required": [
"id",
"created_on",
"modified_on",
"owner_user_id",
"domain_names",
"forward_host",
"forward_port",
"access_list_id",
"certificate_id",
"ssl_forced",
"caching_enabled",
"block_exploits",
"advanced_config",
"meta",
"allow_websocket_upgrade",
"http2_support",
"forward_scheme",
"enabled",
"locations",
"hsts_enabled",
"hsts_subdomains",
"trust_forwarded_proto"
],
"properties": {
"id": {
"$ref": "../common.json#/properties/id"
},
"created_on": {
"$ref": "../common.json#/properties/created_on"
},
"modified_on": {
"$ref": "../common.json#/properties/modified_on"
},
"owner_user_id": {
"$ref": "../common.json#/properties/user_id"
},
"domain_names": {
"$ref": "../common.json#/properties/domain_names"
},
"forward_host": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"pattern": "^[^\\s\\p{Cc};{}\"'#\\\\$/]+(?:/[^\\s\\p{Cc};{}\"'#\\\\]*)?$",
"example": "127.0.0.1"
},
"forward_port": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"example": 8080
},
"access_list_id": {
"$ref": "../common.json#/properties/access_list_id"
},
"certificate_id": {
"$ref": "../common.json#/properties/certificate_id"
},
"ssl_forced": {
"$ref": "../common.json#/properties/ssl_forced"
},
"caching_enabled": {
"$ref": "../common.json#/properties/caching_enabled"
},
"block_exploits": {
"$ref": "../common.json#/properties/block_exploits"
},
"advanced_config": {
"type": "string",
"example": ""
},
"meta": {
"type": "object",
"description": "Extra metadata. Keys starting with nginx_ are owned by the server and ignored on input",
"properties": {
"nginx_online": {
"type": "boolean",
"description": "Server-owned. False only when this host's config is not active in nginx"
},
"nginx_err": {
"type": ["string", "null"],
"description": "Server-owned. Human readable reason when nginx_online is false"
},
"nginx_details": {
"type": ["object", "null"],
"description": "Server-owned. Structured details of the failure (same shape as error.details)"
},
"nginx_checked_at": {
"type": "string",
"description": "Server-owned. ISO timestamp of the last nginx configuration"
},
"nginx_locations": {
"type": "array",
"description": "Server-owned. One entry per custom location, in the same order as locations",
"items": {
"type": "object",
"properties": {
"index": {
"type": "integer"
},
"path": {
"type": "string"
},
"status": {
"type": "string",
"enum": ["ok", "disabled", "quarantined", "unresolved"]
},
"mode": {
"type": ["string", "null"],
"enum": ["dynamic", "static", null]
},
"code": {
"type": ["string", "null"],
"description": "Why the location is not ok, for the UI to word in its language. Unknown codes may be added later: show the message for them",
"enum": [
"empty_path",
"empty_host",
"invalid_host",
"invalid_path",
"unbalanced_braces",
"regex_forward_path",
"named_forward_path",
"unresolved",
"rejected",
"omitted",
null
]
},
"params": {
"type": ["object", "null"],
"description": "Values for the code: host (unresolved), detail (rejected, omitted: nginx's error)",
"additionalProperties": false,
"properties": {
"host": {
"type": "string"
},
"detail": {
"type": "string"
}
}
},
"message": {
"type": ["string", "null"],
"description": "The same in English"
}
}
}
}
},
"example": {
"nginx_online": true,
"nginx_err": null
}
},
"allow_websocket_upgrade": {
"description": "Allow Websocket Upgrade for all paths",
"type": "boolean",
"example": true
},
"http2_support": {
"$ref": "../common.json#/properties/http2_support"
},
"forward_scheme": {
"type": "string",
"enum": ["http", "https"],
"example": "http"
},
"enabled": {
"$ref": "../common.json#/properties/enabled"
},
"locations": {
"type": "array",
"minItems": 0,
"items": {
"type": "object",
"required": ["forward_scheme", "forward_host", "forward_port", "path"],
"additionalProperties": false,
"properties": {
"id": {
"type": ["integer", "null"]
},
"path": {
"type": "string",
"minLength": 1,
"pattern": "^(?!(?:=|~\\*?|\\^~)$)(?:(?:=|~\\*?|\\^~) +)?(?:\"(?:[^\"\\\\\\p{Cc}]|\\\\[^\\p{Cc}])+\"|(?:[^\\s\\p{Cc};{}\"'#\\\\]|\\\\[^\\s\\p{Cc}])+)$"
},
"forward_scheme": {
"$ref": "#/properties/forward_scheme"
},
"forward_host": {
"$ref": "#/properties/forward_host"
},
"forward_port": {
"$ref": "#/properties/forward_port"
},
"forward_path": {
"type": "string",
"pattern": "^[^\\s\\p{Cc};{}\"'#\\\\]*$"
},
"advanced_config": {
"type": "string"
},
"access_list_id": {
"$ref": "../common.json#/properties/access_list_id"
},
"enabled": {
"type": "boolean",
"description": "When false the location is kept but not rendered. Missing means true",
"example": true
}
}
},
"example": [
{
"path": "/app",
"forward_scheme": "http",
"forward_host": "example.com",
"forward_port": 80,
"access_list_id": 0
}
]
},
"hsts_enabled": {
"$ref": "../common.json#/properties/hsts_enabled"
},
"hsts_subdomains": {
"$ref": "../common.json#/properties/hsts_subdomains"
},
"trust_forwarded_proto":{
"type": "boolean",
"description": "Trust the forwarded headers",
"example": false
},
"certificate": {
"oneOf": [
{
"type": "null",
"example": null
},
{
"$ref": "./certificate-object.json"
}
],
"example": null
},
"owner": {
"$ref": "./user-object.json"
},
"access_list": {
"oneOf": [
{
"type": "null",
"example": null
},
{
"$ref": "./access-list-object.json"
}
],
"example": null
}
}
}