Pasted into the server block verbatim. NPM rejects the save if nginx
+ will not load it, and the error comes back here.
+
+
-
`);
+ `, true);
// Wire inline toggles
document.querySelectorAll('#vv-au-modal .vv-au-tog').forEach(t => {
t.addEventListener('click', () => t.classList.toggle('on'));
});
+ document.getElementById('pm-adv-toggle').addEventListener('click', () => {
+ const sec = document.getElementById('pm-adv');
+ const open = sec.classList.toggle('open');
+ document.getElementById('pm-adv-toggle').textContent =
+ (open ? '▼' : '▶') + ' Custom Nginx Configuration';
+ });
+
document.getElementById('pm-cancel').onclick = _closeModal;
document.getElementById('pm-save').onclick = () => {
const domains = document.getElementById('pm-domains').value.split(',').map(s=>s.trim()).filter(Boolean);
@@ -712,6 +752,14 @@ function _proxyModal(id) {
const host = document.getElementById('pm-host').value.trim();
if (!host) { _showModalErr('pm-err', 'Forward host required'); return; }
+ // NPM's update replaces the whole host, so anything not sent here is not "left alone" — it is
+ // reset. This object used to hardcode advanced_config to '', http2 and both HSTS flags to
+ // false, meta to {} and locations to [], and enabled to true. Editing a port therefore removed
+ // the site's auth_request block, turned off HTTP/2 and HSTS, dropped its custom locations, and
+ // switched a deliberately disabled host back on.
+ //
+ // Everything the dialog does not offer is carried from the host it is editing; only a genuinely
+ // new host gets defaults.
const data = {
domain_names: domains,
forward_scheme: document.getElementById('pm-scheme').value,
@@ -721,13 +769,17 @@ function _proxyModal(id) {
ssl_forced: document.getElementById('pm-ssl-forced').classList.contains('on'),
block_exploits: document.getElementById('pm-block-exploits').classList.contains('on'),
allow_websocket_upgrade: document.getElementById('pm-websocket').classList.contains('on'),
- http2_support: false,
- hsts_enabled: false,
- hsts_subdomains: false,
- meta: {},
- locations: [],
- advanced_config: '',
- enabled: true,
+ http2_support: document.getElementById('pm-http2').classList.contains('on'),
+ hsts_enabled: document.getElementById('pm-hsts').classList.contains('on'),
+ hsts_subdomains: document.getElementById('pm-hsts-sub').classList.contains('on'),
+ enabled: document.getElementById('pm-enabled').classList.contains('on'),
+ advanced_config: document.getElementById('pm-advanced').value,
+ // Not represented in this dialog at all. Preserved rather than blanked — an access list is a
+ // deliberate restriction and a location block is routing, and losing either quietly is worse
+ // than not being able to edit it here.
+ access_list_id: p ? (p.access_list_id ?? 0) : 0,
+ meta: p ? (p.meta ?? {}) : {},
+ locations: p ? (p.locations ?? []) : [],
};
const btn = document.getElementById('pm-save');