Manage Nginx Proxy Manager proxy hosts from the Proxy hosts page

With an optional second user on the NPM integration (Manage on Proxy Hosts,
no two-factor sign-in) an administrator can make, change, switch off and
delete proxy hosts: names, where it forwards to, an existing certificate and
what is switched on. Only what differs is sent, a host's access list,
locations and custom configuration are never touched, and combinations NPM
would quietly undo (Force HTTPS, HTTP/2 or HSTS without a certificate) are
refused with the reason. Delete asks for the host's first name, checked
against the host as NPM has it. The user that reads is still view-only and
never writes. Audited; the managing user can be taken away again.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-03 19:24:00 +01:00
1 parent 672c7f2f66
commit 4dd7901f1c
13 files changed
+1286 -14

No files matched your search

+29 -1
View File
@@ -2258,6 +2258,14 @@ export interface NpmHost {
forwardPort: number | null;
enabled: boolean;
sslForced: boolean;
http2: boolean;
hsts: boolean;
hstsSubdomains: boolean;
blockExploits: boolean;
caching: boolean;
websocket: boolean;
/** The certificate it uses, by id; null for none. */
certificateId: number | null;
certificate: { id: number; name: string; expiresAt: string | null } | null;
online: boolean;
error: string | null;
@@ -2280,8 +2288,24 @@ export interface IntegrationProblem {
message: string;
}
/** What a proxy host is made of, as it is made and changed from here. */
export interface NpmHostSettings {
domains: string[];
scheme: "http" | "https";
host: string;
port: number;
certificateId: number | null;
sslForced: boolean;
http2: boolean;
hsts: boolean;
hstsSubdomains: boolean;
blockExploits: boolean;
caching: boolean;
websocket: boolean;
}
export interface NpmOverview {
integrations: { id: number; name: string; readAt: string; error: string | null; version: string | null; hosts: NpmHost[]; certificates: NpmCertificate[]; problems: IntegrationProblem[] }[];
integrations: { id: number; name: string; /** Whether it has a user to manage proxy hosts with. */ canManage: boolean; readAt: string; error: string | null; version: string | null; hosts: NpmHost[]; certificates: NpmCertificate[]; problems: IntegrationProblem[] }[];
}
export interface HaSyncStatus {
@@ -3690,6 +3714,10 @@ export const api = {
},
npm: {
overview: (refresh = false) => request<NpmOverview>(`/api/npm${refresh ? "?refresh=1" : ""}`),
createHost: (integrationId: number, body: NpmHostSettings) => request<{ host: NpmHost }>(`/api/npm/${integrationId}/hosts`, { method: "POST", body: JSON.stringify(body) }),
updateHost: (integrationId: number, hostId: number, body: Partial<NpmHostSettings>) => request<{ changed: string[]; host: NpmHost }>(`/api/npm/${integrationId}/hosts/${hostId}`, { method: "PATCH", body: JSON.stringify(body) }),
setHostEnabled: (integrationId: number, hostId: number, enabled: boolean) => request<{ enabled: boolean; changed: boolean }>(`/api/npm/${integrationId}/hosts/${hostId}/enabled`, { method: "POST", body: JSON.stringify({ enabled }) }),
deleteHost: (integrationId: number, hostId: number, domain: string) => request<void>(`/api/npm/${integrationId}/hosts/${hostId}`, { method: "DELETE", body: JSON.stringify({ domain }) }),
},
homeAssistant: {
overview: () => request<HaOverview>("/api/home-assistant"),