Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Keep CORS setup exact-origin and credential-aware

pulse-triage[bot]46307a8c81ab
diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md
index 20cf7967ef..b259cfef8c 100644
--- a/docs/CONFIGURATION.md
+++ b/docs/CONFIGURATION.md
@@ -203,7 +203,7 @@ Controls runtime behavior like logging, polling intervals, and UI preferences. L
"logLevel": "info", // debug, info, warn, error
"autoUpdateEnabled": false, // Enable auto-update checks
"adaptivePollingEnabled": false, // Smart polling for large clusters
- "allowedOrigins": "", // CORS allowlist (single origin or "*")
+ "allowedOrigins": "", // CORS: empty or comma-separated exact origins
"allowEmbedding": false, // Allow iframe embedding
"allowedEmbedOrigins": "", // Comma-separated origins for iframe embedding
"webhookAllowedPrivateCIDRs": "" // Allowlist for private webhook targets
@@ -230,7 +230,7 @@ Numeric intervals are **seconds** unless noted otherwise.
| `adaptivePollingMaxInterval` | Maximum adaptive polling interval |
| `connectionTimeout` | API connection timeout |
| `logLevel` | Server log level (`debug`, `info`, `warn`, `error`) |
-| `allowedOrigins` | CORS allowlist (single origin or `*`) |
+| `allowedOrigins` | CORS: empty grants no cross-origin browser permission; comma-separated exact origins allow credentialed browser requests. `*` allows any origin without credentials. |
| `allowEmbedding` | Allow iframe embedding |
| `allowedEmbedOrigins` | Comma-separated `frame-ancestors` allowlist |
| `webhookAllowedPrivateCIDRs` | Allowlist for private webhook targets |
@@ -293,7 +293,7 @@ Environment variables take precedence over `system.json`.
| `PULSE_AGENT_CONFIG_SIGNING_KEY` | Base64 Ed25519 private key used to sign remote agent config payloads. | *(unset)* |
| `PULSE_AGENT_CONFIG_PUBLIC_KEYS` | Comma-separated base64 Ed25519 public keys (raw 32-byte or PKIX-encoded) trusted by agents. | *(unset)* |
| `PULSE_AGENT_CONFIG_SIGNATURE_REQUIRED` | Require signed remote config payloads (set on Pulse and agents). | `false` |
-| `ALLOWED_ORIGINS` | CORS allowed origin (`*` or a single origin). Empty = same-origin only. | *(unset)* |
+| `ALLOWED_ORIGINS` | Overrides the saved CORS allowlist with comma-separated exact origins. `*` permits any origin without credentialed browser access; not a login/proxy repair. | *(unset)* |
| `DISCOVERY_ENABLED` | Auto-discover nodes | `false` |
| `DISCOVERY_SUBNET` | CIDR or `auto` | `auto` |
| `DISCOVERY_ENVIRONMENT_OVERRIDE` | Force discovery environment (`auto`, `native`, `docker-host`, `docker-bridge`, `lxc-privileged`, `lxc-unprivileged`) | `auto` |
diff --git a/docs/FAQ.md b/docs/FAQ.md
index cf6ceeafec..ad35e2b307 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -203,7 +203,12 @@ redacted error and use its platform guide above; changing Pulse's listening
port does not repair the platform connection.
### CORS errors?
-Pulse defaults to same-origin only. If you access the API from a different domain, set **Settings → System → Network → Allowed Origins** or use `ALLOWED_ORIGINS` (single origin, or `*` if you explicitly want all origins).
+
+Keep the default same-origin policy when Pulse and its API use the same public
+origin, including behind a reverse proxy. If a separate trusted browser app
+needs cross-origin API access, allow only its exact origin (scheme, host and
+port); `*` is not a login or proxy repair. Follow the
+[CORS checks](TROUBLESHOOTING.md#cors-errors) before broadening browser access.
### High memory usage?
First distinguish container usage from Pulse's resident memory (RSS); a high
diff --git a/docs/REVERSE_PROXY.md b/docs/REVERSE_PROXY.md
index d0fdf9bd98..e572d97048 100644
--- a/docs/REVERSE_PROXY.md
+++ b/docs/REVERSE_PROXY.md
@@ -10,6 +10,11 @@ Keep Pulse authentication enabled; TLS termination does not authenticate users.
For identity supplied by an IdP/proxy, follow the separate
[proxy authentication guide](PROXY_AUTH.md), including its Header Trust Boundary.
+A same-origin reverse proxy needs no CORS exception. Keep the UI and API on the
+same public origin rather than adding `*` to repair a login or routing error.
+For a separate trusted browser app, follow the
+[exact-origin CORS checks](TROUBLESHOOTING.md#cors-errors).
+
**Forwarded HTTPS headers are trusted only from a configured immediate peer.**
Set `PULSE_TRUSTED_PROXY_CIDRS` in Pulse's deployment configuration to the proxy
address **as seen by Pulse**, not the browser's address or the public hostname.
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index c2e9c76bb6..726df71068 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -149,6 +149,40 @@ do not replace credentials or disable TLS verification on a refusal alone.
For a page that opens but has missing readings, use the
[missing-data checks](FAQ.md#no-data-showing) instead of resetting the connection.
+### CORS errors
+
+CORS controls whether a browser can read a response from a different origin.
+It is not Pulse's connection to Proxmox, PBS or TrueNAS, and it does not replace
+authentication, CSRF protection or TLS.
+
+In your browser's developer tools, compare the page's origin with the failed
+API request's origin and HTTP status. An origin consists of **scheme, host and
+port**: HTTP and HTTPS, or two different ports, are different origins. Review
+the original console error locally; a certificate failure, login redirect or
+401/403 response needs its own correction, not a broader CORS allowlist.
+
+- **Pulse UI and API share a public origin:** a same-origin reverse proxy needs
+ no CORS exception. Keep the API behind that proxy and correct its routing or
+ [trusted forwarded headers](REVERSE_PROXY.md#before-configuring-the-proxy);
+ do not expose the backend or add wildcard response headers to bypass it.
+- **A separate trusted browser app needs API access:** in **Settings → System →
+ Network → CORS Allowed Origins**, list only that app's exact origin, for
+ example `https://app.example.com:8443`. Do not include a path, trailing slash
+ or a hostname pattern. Multiple exact origins are comma-separated.
+ `ALLOWED_ORIGINS` overrides the saved setting; removing that environment
+ override does not erase an existing saved allowlist. Re-open settings after
+ saving and verify the effective value and the ordinary browser request.
+
+An empty policy grants no cross-origin browser permission. `*` allows any
+origin **without credentialed browser access**; it cannot fix a request that
+needs a browser session cookie. Do not disable authentication, CSRF protection
+or TLS verification to make such a request work. Iframe embedding and proxy
+authentication have separate settings; CORS is not their trust boundary.
+
+Keep cookies, authorization headers, API tokens and full network exports
+private. A report needs only the redacted error, HTTP status and relevant
+origins, not a credential-bearing request or HAR file.
+
---
## 🔍 Common Issues
diff --git a/frontend-modern/browser-tests/cors-guidance.cjs b/frontend-modern/browser-tests/cors-guidance.cjs
new file mode 100644
index 0000000000..dad919d985
--- /dev/null
+++ b/frontend-modern/browser-tests/cors-guidance.cjs
@@ -0,0 +1,93 @@
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const path = require('node:path');
+const { createHash } = require('node:crypto');
+const { chromium, webkit } = require('playwright');
+
+(async () => {
+ const root = path.resolve('frontend-modern');
+ const artifacts = path.join(root, 'node_modules', 'cors-guidance-browser');
+ fs.mkdirSync(artifacts, { recursive: true });
+ process.chdir(root);
+ const { createServer } = await import(path.join(root, 'node_modules/vite/dist/node/index.js'));
+ const server = await createServer({
+ root, configFile: path.join(root, 'vite.config.ts'),
+ cacheDir: path.join(root, 'node_modules', '.vite-cors-guidance'),
+ server: { host: '127.0.0.1', port: 5258, strictPort: true },
+ optimizeDeps: { noDiscovery: true, include: [] },
+ });
+ const results = [];
+ let browser;
+ try {
+ await server.listen();
+ for (const [engine, width, tone] of [['chromium', 1280, 'light'], ['webkit', 390, 'dark']]) {
+ browser = await { chromium, webkit }[engine].launch(engine === 'chromium'
+ ? { headless: true, channel: 'chromium', args: ['--no-sandbox'] }
+ : { headless: true });
+ const page = await browser.newPage({ viewport: { width, height: 1000 },
+ ...(engine === 'webkit' ? { isMobile: true, hasTouch: true } : {}) });
+ const errors = [];
+ page.on('pageerror', (error) => errors.push(error.message));
+ page.on('console', (message) => { if (message.type() === 'error') errors.push(message.text()); });
+ for (const override of [false, true]) {
+ await page.goto(`http://127.0.0.1:5258/browser-tests/cors-guidance.html${override ? '?override=1' : ''}`,
+ { waitUntil: 'domcontentloaded', timeout: 60_000 });
+ if (tone === 'dark') await page.evaluate(() => document.documentElement.classList.add('dark'));
+ const input = page.getByRole('textbox', { name: 'CORS Allowed Origins', exact: true });
+ await input.waitFor();
+ assert.equal(await input.getAttribute('placeholder'), 'https://app.example.com:8443');
+ assert.equal(await input.getAttribute('aria-describedby'), 'cors-origin-help cors-origin-limits');
+ assert.ok((await page.locator('#cors-origin-help').innerText()).includes('no CORS exception'));
+ assert.ok((await page.locator('#cors-origin-limits').innerText()).includes('without credentialed browser access'));
+ assert.equal(await input.isDisabled(), override);
+ assert.equal(await input.inputValue(), override ? 'https://managed.example.com' : '');
+ assert.equal(await page.getByRole('status', { name: 'Fixture changed' }).innerText(), 'unchanged');
+ if (!override) {
+ await input.focus();
+ await page.keyboard.type('https://one.example.com,https://two.example.com:8443');
+ assert.equal(await input.inputValue(), 'https://one.example.com,https://two.example.com:8443');
+ assert.equal(await page.getByRole('status', { name: 'Fixture changed' }).innerText(), 'changed');
+ assert.ok(await input.evaluate((element) => document.activeElement === element));
+ }
+ await page.locator('#cors-origin-help').scrollIntoViewIfNeeded();
+ assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1));
+ await page.screenshot({ path: path.join(artifacts, `${engine}-${override ? 'override' : 'editable'}.png`) });
+ }
+ const faq = page.getByRole('link', { name: 'Open FAQ', exact: true });
+ await faq.focus();
+ await page.keyboard.press('Enter');
+ await page.locator('#cors-errors').waitFor();
+ const help = page.getByRole('link', { name: 'CORS checks', exact: true });
+ assert.equal(await help.getAttribute('href'), '/docs/TROUBLESHOOTING#cors-errors');
+ await help.focus();
+ await page.keyboard.press('Enter');
+ await page.waitForFunction(() => {
+ const heading = document.getElementById('cors-errors');
+ return heading && heading.getBoundingClientRect().top >= 0 && heading.getBoundingClientRect().top < innerHeight;
+ });
+ assert.ok(page.url().endsWith('/docs/TROUBLESHOOTING#cors-errors'));
+ const text = await page.locator('article').innerText();
+ for (const phrase of ['without credentialed browser access', 'Multiple exact origins are comma-separated',
+ 'verify the effective value', 'Keep cookies, authorization headers']) assert.ok(text.includes(phrase), phrase);
+ assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1));
+ await page.screenshot({ path: path.join(artifacts, `${engine}-help.png`) });
+ assert.deepEqual(errors, []);
+ results.push({ engine, browserVersion: browser.version(), width, tone, editableAndOverride: true,
+ keyboardInputAndHelpLink: true, descriptionAssociation: true, noBodyOverflow: true, errors });
+ await browser.close();
+ browser = undefined;
+ }
+ const files = ['src/components/Settings/NetworkBoundarySettingsSection.tsx',
+ ...['FAQ', 'TROUBLESHOOTING', 'CONFIGURATION', 'REVERSE_PROXY'].map((name) => `public/docs/${name}.md`)];
+ const content_sha256 = Object.fromEntries(files.map((file) => [`frontend-modern/${file}`,
+ createHash('sha256').update(fs.readFileSync(path.join(root, file))).digest('hex')]));
+ const result = { result: 'passed', playwrightVersion: require('playwright/package.json').version,
+ scope: 'real component/Docs/router/CSS fixtures; not native CORS, settings persistence, authentication or proxy acceptance',
+ content_sha256, results };
+ fs.writeFileSync(path.join(artifacts, 'result.json'), JSON.stringify(result, null, 2) + '\n');
+ console.log(JSON.stringify(result));
+ } finally {
+ if (browser) await browser.close();
+ await server.close();
+ }
+})().catch((error) => { console.error(error); process.exitCode = 1; });
diff --git a/frontend-modern/browser-tests/cors-guidance.html b/frontend-modern/browser-tests/cors-guidance.html
new file mode 100644
index 0000000000..ed50d53764
--- /dev/null
+++ b/frontend-modern/browser-tests/cors-guidance.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="UTF-8" />
+ <link rel="icon" href="data:," />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ </head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="/browser-tests/cors-guidance.tsx"></script>
+ </body>
+</html>
diff --git a/frontend-modern/browser-tests/cors-guidance.tsx b/frontend-modern/browser-tests/cors-guidance.tsx
new file mode 100644
index 0000000000..cb0ae91e70
--- /dev/null
+++ b/frontend-modern/browser-tests/cors-guidance.tsx
@@ -0,0 +1,56 @@
+// Real settings section, Docs, router and CSS with local signal-only settings.
+// No backend, credential, proxy, save or browser CORS request is exercised.
+import { createSignal } from 'solid-js';
+import { render } from 'solid-js/web';
+import { A, Route, Router } from '@solidjs/router';
+import { NetworkBoundarySettingsSection } from '../src/components/Settings/NetworkBoundarySettingsSection';
+import Docs from '../src/pages/Docs';
+import '../src/index.css';
+
+const overridden = new URLSearchParams(window.location.search).get('override') === '1';
+window.history.replaceState({}, '', `/settings/system/network${overridden ? '?override=1' : ''}`);
+
+function SettingsFixture() {
+ const [publicURL, setPublicURL] = createSignal('');
+ const [allowedOrigins, setAllowedOrigins] = createSignal(
+ overridden ? 'https://managed.example.com' : '',
+ );
+ const [allowEmbedding, setAllowEmbedding] = createSignal(false);
+ const [allowedEmbedOrigins, setAllowedEmbedOrigins] = createSignal('');
+ const [webhookAllowedPrivateCIDRs, setWebhookAllowedPrivateCIDRs] = createSignal('');
+ const [dirty, setHasUnsavedChanges] = createSignal(false);
+ return (
+ <main class="max-w-3xl mx-auto p-4 bg-surface text-base-content">
+ <h1 class="text-xl font-semibold">Network settings</h1>
+ <NetworkBoundarySettingsSection
+ publicURL={publicURL}
+ setPublicURL={setPublicURL}
+ allowedOrigins={allowedOrigins}
+ setAllowedOrigins={setAllowedOrigins}
+ allowEmbedding={allowEmbedding}
+ setAllowEmbedding={setAllowEmbedding}
+ allowedEmbedOrigins={allowedEmbedOrigins}
+ setAllowedEmbedOrigins={setAllowedEmbedOrigins}
+ webhookAllowedPrivateCIDRs={webhookAllowedPrivateCIDRs}
+ setWebhookAllowedPrivateCIDRs={setWebhookAllowedPrivateCIDRs}
+ envOverrides={() => ({ allowedOrigins: overridden })}
+ setHasUnsavedChanges={setHasUnsavedChanges}
+ />
+ <output aria-label="Fixture changed">{dirty() ? 'changed' : 'unchanged'}</output>
+ <nav>
+ <A href="/docs/FAQ">Open FAQ</A>
+ </nav>
+ </main>
+ );
+}
+
+render(
+ () => (
+ <Router>
+ <Route path="/settings/system/network" component={SettingsFixture} />
+ <Route path="/docs" component={Docs} />
+ <Route path="/docs/*docPath" component={Docs} />
+ </Router>
+ ),
+ document.getElementById('root')!,
+);
diff --git a/frontend-modern/browser-verification/c9af080810c2da74.json b/frontend-modern/browser-verification/c9af080810c2da74.json
new file mode 100644
index 0000000000..79f40c3500
--- /dev/null
+++ b/frontend-modern/browser-verification/c9af080810c2da74.json
@@ -0,0 +1,47 @@
+{
+ "version": 1,
+ "base_sha": "970f8ec019e2a1b7388b489a1682e6709079e28d",
+ "verified_at": "2026-10-06T08:16:12Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Settings/NetworkBoundarySettingsSection.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Settings/NetworkBoundarySettingsSection.tsx": "760a55c1a97677123543d5dffc0af7007bbe0fd28019587418a92f9c4d84e0b5"
+ },
+ "routes": [
+ "/settings/system/network (real section in signal-only fixture)",
+ "/docs/FAQ",
+ "/docs/TROUBLESHOOTING#cors-errors"
+ ],
+ "viewports": [
+ {
+ "width": 1280,
+ "height": 1000
+ },
+ {
+ "width": 390,
+ "height": 1000
+ }
+ ],
+ "states": [
+ "editable empty default with no automatic setting changes",
+ "exact comma-separated keyboard input",
+ "environment-overridden disabled field",
+ "light desktop and dark narrow layout",
+ "rendered FAQ to CORS diagnosis and effective-policy guidance"
+ ],
+ "interactions": [
+ "keyboard focus and typed exact origins preserve the supplied values and dirty signal",
+ "override remains disabled and unchanged",
+ "keyboard activation of FAQ and CORS check link focuses/scolls the real target heading",
+ "ARIA description IDs resolve to both policy and credential limits",
+ "all six captures inspected: readable helper and override text, visible input focus, no viewport overflow"
+ ],
+ "scope": "real component/Docs/router/CSS fixtures; not native CORS, settings persistence, authentication or proxy acceptance",
+ "playwright_version": "1.56.1",
+ "browser_versions": {
+ "chromium": "141.0.7390.37",
+ "webkit": "26.0"
+ }
+}
diff --git a/frontend-modern/public/docs/CONFIGURATION.md b/frontend-modern/public/docs/CONFIGURATION.md
index 20cf7967ef..b259cfef8c 100644
--- a/frontend-modern/public/docs/CONFIGURATION.md
+++ b/frontend-modern/public/docs/CONFIGURATION.md
@@ -203,7 +203,7 @@ Controls runtime behavior like logging, polling intervals, and UI preferences. L
"logLevel": "info", // debug, info, warn, error
"autoUpdateEnabled": false, // Enable auto-update checks
"adaptivePollingEnabled": false, // Smart polling for large clusters
- "allowedOrigins": "", // CORS allowlist (single origin or "*")
+ "allowedOrigins": "", // CORS: empty or comma-separated exact origins
"allowEmbedding": false, // Allow iframe embedding
"allowedEmbedOrigins": "", // Comma-separated origins for iframe embedding
"webhookAllowedPrivateCIDRs": "" // Allowlist for private webhook targets
@@ -230,7 +230,7 @@ Numeric intervals are **seconds** unless noted otherwise.
| `adaptivePollingMaxInterval` | Maximum adaptive polling interval |
| `connectionTimeout` | API connection timeout |
| `logLevel` | Server log level (`debug`, `info`, `warn`, `error`) |
-| `allowedOrigins` | CORS allowlist (single origin or `*`) |
+| `allowedOrigins` | CORS: empty grants no cross-origin browser permission; comma-separated exact origins allow credentialed browser requests. `*` allows any origin without credentials. |
| `allowEmbedding` | Allow iframe embedding |
| `allowedEmbedOrigins` | Comma-separated `frame-ancestors` allowlist |
| `webhookAllowedPrivateCIDRs` | Allowlist for private webhook targets |
@@ -293,7 +293,7 @@ Environment variables take precedence over `system.json`.
| `PULSE_AGENT_CONFIG_SIGNING_KEY` | Base64 Ed25519 private key used to sign remote agent config payloads. | *(unset)* |
| `PULSE_AGENT_CONFIG_PUBLIC_KEYS` | Comma-separated base64 Ed25519 public keys (raw 32-byte or PKIX-encoded) trusted by agents. | *(unset)* |
| `PULSE_AGENT_CONFIG_SIGNATURE_REQUIRED` | Require signed remote config payloads (set on Pulse and agents). | `false` |
-| `ALLOWED_ORIGINS` | CORS allowed origin (`*` or a single origin). Empty = same-origin only. | *(unset)* |
+| `ALLOWED_ORIGINS` | Overrides the saved CORS allowlist with comma-separated exact origins. `*` permits any origin without credentialed browser access; not a login/proxy repair. | *(unset)* |
| `DISCOVERY_ENABLED` | Auto-discover nodes | `false` |
| `DISCOVERY_SUBNET` | CIDR or `auto` | `auto` |
| `DISCOVERY_ENVIRONMENT_OVERRIDE` | Force discovery environment (`auto`, `native`, `docker-host`, `docker-bridge`, `lxc-privileged`, `lxc-unprivileged`) | `auto` |
diff --git a/frontend-modern/public/docs/FAQ.md b/frontend-modern/public/docs/FAQ.md
index cf6ceeafec..ad35e2b307 100644
--- a/frontend-modern/public/docs/FAQ.md
+++ b/frontend-modern/public/docs/FAQ.md
@@ -203,7 +203,12 @@ redacted error and use its platform guide above; changing Pulse's listening
port does not repair the platform connection.
### CORS errors?
-Pulse defaults to same-origin only. If you access the API from a different domain, set **Settings → System → Network → Allowed Origins** or use `ALLOWED_ORIGINS` (single origin, or `*` if you explicitly want all origins).
+
+Keep the default same-origin policy when Pulse and its API use the same public
+origin, including behind a reverse proxy. If a separate trusted browser app
+needs cross-origin API access, allow only its exact origin (scheme, host and
+port); `*` is not a login or proxy repair. Follow the
+[CORS checks](TROUBLESHOOTING.md#cors-errors) before broadening browser access.
### High memory usage?
First distinguish container usage from Pulse's resident memory (RSS); a high
diff --git a/frontend-modern/public/docs/REVERSE_PROXY.md b/frontend-modern/public/docs/REVERSE_PROXY.md
index d0fdf9bd98..e572d97048 100644
--- a/frontend-modern/public/docs/REVERSE_PROXY.md
+++ b/frontend-modern/public/docs/REVERSE_PROXY.md
@@ -10,6 +10,11 @@ Keep Pulse authentication enabled; TLS termination does not authenticate users.
For identity supplied by an IdP/proxy, follow the separate
[proxy authentication guide](PROXY_AUTH.md), including its Header Trust Boundary.
+A same-origin reverse proxy needs no CORS exception. Keep the UI and API on the
+same public origin rather than adding `*` to repair a login or routing error.
+For a separate trusted browser app, follow the
+[exact-origin CORS checks](TROUBLESHOOTING.md#cors-errors).
+
**Forwarded HTTPS headers are trusted only from a configured immediate peer.**
Set `PULSE_TRUSTED_PROXY_CIDRS` in Pulse's deployment configuration to the proxy
address **as seen by Pulse**, not the browser's address or the public hostname.
diff --git a/frontend-modern/public/docs/TROUBLESHOOTING.md b/frontend-modern/public/docs/TROUBLESHOOTING.md
index c2e9c76bb6..726df71068 100644
--- a/frontend-modern/public/docs/TROUBLESHOOTING.md
+++ b/frontend-modern/public/docs/TROUBLESHOOTING.md
@@ -149,6 +149,40 @@ do not replace credentials or disable TLS verification on a refusal alone.
For a page that opens but has missing readings, use the
[missing-data checks](FAQ.md#no-data-showing) instead of resetting the connection.
+### CORS errors
+
+CORS controls whether a browser can read a response from a different origin.
+It is not Pulse's connection to Proxmox, PBS or TrueNAS, and it does not replace
+authentication, CSRF protection or TLS.
+
+In your browser's developer tools, compare the page's origin with the failed
+API request's origin and HTTP status. An origin consists of **scheme, host and
+port**: HTTP and HTTPS, or two different ports, are different origins. Review
+the original console error locally; a certificate failure, login redirect or
+401/403 response needs its own correction, not a broader CORS allowlist.
+
+- **Pulse UI and API share a public origin:** a same-origin reverse proxy needs
+ no CORS exception. Keep the API behind that proxy and correct its routing or
+ [trusted forwarded headers](REVERSE_PROXY.md#before-configuring-the-proxy);
+ do not expose the backend or add wildcard response headers to bypass it.
+- **A separate trusted browser app needs API access:** in **Settings → System →
+ Network → CORS Allowed Origins**, list only that app's exact origin, for
+ example `https://app.example.com:8443`. Do not include a path, trailing slash
+ or a hostname pattern. Multiple exact origins are comma-separated.
+ `ALLOWED_ORIGINS` overrides the saved setting; removing that environment
+ override does not erase an existing saved allowlist. Re-open settings after
+ saving and verify the effective value and the ordinary browser request.
+
+An empty policy grants no cross-origin browser permission. `*` allows any
+origin **without credentialed browser access**; it cannot fix a request that
+needs a browser session cookie. Do not disable authentication, CSRF protection
+or TLS verification to make such a request work. Iframe embedding and proxy
+authentication have separate settings; CORS is not their trust boundary.
+
+Keep cookies, authorization headers, API tokens and full network exports
+private. A report needs only the redacted error, HTTP status and relevant
+origins, not a credential-bearing request or HAR file.
+
---
## 🔍 Common Issues
diff --git a/frontend-modern/src/components/Settings/NetworkBoundarySettingsSection.tsx b/frontend-modern/src/components/Settings/NetworkBoundarySettingsSection.tsx
index 174ea03989..4af47548d7 100644
--- a/frontend-modern/src/components/Settings/NetworkBoundarySettingsSection.tsx
+++ b/frontend-modern/src/components/Settings/NetworkBoundarySettingsSection.tsx
@@ -108,13 +108,21 @@ export const NetworkBoundarySettingsSection: Component<NetworkBoundarySettingsSe
<label for="cors-allowed-origins" class="text-sm font-medium text-base-content">
CORS Allowed Origins
</label>
- <p class="text-xs text-muted">
- For reverse proxy setups (* = allow all, empty = same-origin only)
+ <p id="cors-origin-help" class="text-xs text-muted">
+ A same-origin reverse proxy needs no CORS exception. For a separate browser app, allow
+ only its exact trusted origin (scheme, host and port), without a path or trailing slash.
+ Separate origins with commas.
+ </p>
+ <p id="cors-origin-limits" class="text-xs text-muted">
+ Empty grants no cross-origin browser permission. * allows any origin without
+ credentialed browser access; it is not a login or proxy repair. CORS does not replace
+ authentication, CSRF protection or TLS.
</p>
<div class="relative">
<input
id="cors-allowed-origins"
type="text"
+ aria-describedby="cors-origin-help cors-origin-limits"
value={props.allowedOrigins()}
onInput={(e) => {
if (!props.envOverrides().allowedOrigins) {
@@ -123,7 +131,7 @@ export const NetworkBoundarySettingsSection: Component<NetworkBoundarySettingsSe
}
}}
disabled={props.envOverrides().allowedOrigins}
- placeholder="* or https://example.com"
+ placeholder="https://app.example.com:8443"
class={`w-full min-h-10 sm:min-h-10 px-3 py-2.5 text-sm border rounded-md ${
props.envOverrides().allowedOrigins
? 'border-amber-300 dark:border-amber-600 bg-amber-50 dark:bg-amber-900/25 cursor-not-allowed opacity-75'
diff --git a/frontend-modern/src/components/Settings/__tests__/NetworkBoundaryCorsGuidance.test.tsx b/frontend-modern/src/components/Settings/__tests__/NetworkBoundaryCorsGuidance.test.tsx
new file mode 100644
index 0000000000..3a247272af
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/NetworkBoundaryCorsGuidance.test.tsx
@@ -0,0 +1,77 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { NetworkBoundarySettingsSection } from '../NetworkBoundarySettingsSection';
+
+function setup(overridden = false) {
+ const setAllowedOrigins = vi.fn();
+ const setHasUnsavedChanges = vi.fn();
+ const Harness = () => {
+ const [publicURL, setPublicURL] = createSignal('');
+ const [allowEmbedding, setAllowEmbedding] = createSignal(false);
+ const [allowedEmbedOrigins, setAllowedEmbedOrigins] = createSignal('');
+ const [webhookAllowedPrivateCIDRs, setWebhookAllowedPrivateCIDRs] = createSignal('');
+ return (
+ <NetworkBoundarySettingsSection
+ publicURL={publicURL}
+ setPublicURL={setPublicURL}
+ allowEmbedding={allowEmbedding}
+ setAllowEmbedding={setAllowEmbedding}
+ allowedEmbedOrigins={allowedEmbedOrigins}
+ setAllowedEmbedOrigins={setAllowedEmbedOrigins}
+ webhookAllowedPrivateCIDRs={webhookAllowedPrivateCIDRs}
+ setWebhookAllowedPrivateCIDRs={setWebhookAllowedPrivateCIDRs}
+ allowedOrigins={() => (overridden ? 'https://managed.example.com' : '')}
+ envOverrides={() => ({ allowedOrigins: overridden })}
+ setAllowedOrigins={setAllowedOrigins}
+ setHasUnsavedChanges={setHasUnsavedChanges}
+ />
+ );
+ };
+ render(() => <Harness />);
+ return {
+ input: screen.getByRole('textbox', { name: 'CORS Allowed Origins' }),
+ setAllowedOrigins,
+ setHasUnsavedChanges,
+ };
+}
+
+afterEach(cleanup);
+
+describe('CORS settings guidance', () => {
+ it('associates exact-origin and credential limits with the labelled control', () => {
+ const { input, setAllowedOrigins, setHasUnsavedChanges } = setup();
+ expect(input).toHaveAccessibleDescription(/same-origin reverse proxy needs no CORS exception/);
+ expect(input).toHaveAccessibleDescription(/scheme, host and port/);
+ expect(input).toHaveAccessibleDescription(/without a path or trailing slash/);
+ expect(input).toHaveAccessibleDescription(/Separate origins with commas/);
+ expect(input).toHaveAccessibleDescription(/without credentialed browser access/);
+ expect(input).toHaveAccessibleDescription(/not a login or proxy repair/);
+ expect(input).toHaveAccessibleDescription(/authentication, CSRF protection or TLS/);
+ expect(input).toHaveAttribute('placeholder', 'https://app.example.com:8443');
+ expect(input).toHaveValue('');
+ expect(setAllowedOrigins).not.toHaveBeenCalled();
+ expect(setHasUnsavedChanges).not.toHaveBeenCalled();
+ });
+
+ it('preserves explicit user input and marks the existing form dirty', () => {
+ const { input, setAllowedOrigins, setHasUnsavedChanges } = setup();
+ const value = 'https://one.example.com,https://two.example.com:8443';
+ fireEvent.input(input, { target: { value } });
+ expect(setAllowedOrigins).toHaveBeenCalledExactlyOnceWith(value);
+ expect(setHasUnsavedChanges).toHaveBeenCalledExactlyOnceWith(true);
+ });
+
+ it('preserves environment override and does not silently widen its value', () => {
+ const { input, setAllowedOrigins, setHasUnsavedChanges } = setup(true);
+ expect(input).toBeDisabled();
+ expect(input).toHaveValue('https://managed.example.com');
+ expect(input).toHaveAccessibleDescription(/not a login or proxy repair/);
+ expect(
+ screen.getByText('Overridden by ALLOWED_ORIGINS environment variable'),
+ ).toBeInTheDocument();
+ fireEvent.input(input, { target: { value: '*' } });
+ expect(setAllowedOrigins).not.toHaveBeenCalled();
+ expect(setHasUnsavedChanges).not.toHaveBeenCalled();
+ });
+});
diff --git a/frontend-modern/src/features/docs/__tests__/corsGuidance.test.ts b/frontend-modern/src/features/docs/__tests__/corsGuidance.test.ts
new file mode 100644
index 0000000000..f82c73eb07
--- /dev/null
+++ b/frontend-modern/src/features/docs/__tests__/corsGuidance.test.ts
@@ -0,0 +1,126 @@
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { describe, expect, it } from 'vitest';
+import { renderDocMarkdown } from '../docMarkdown';
+
+const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../..');
+const names = ['FAQ', 'TROUBLESHOOTING', 'CONFIGURATION', 'REVERSE_PROXY'];
+
+function guide(name: string): HTMLElement {
+ const root =
+ names.includes(name) && process.env.PULSE_CORS_DOCS_TEST_DIR
+ ? process.env.PULSE_CORS_DOCS_TEST_DIR
+ : path.join(repoRoot, 'frontend-modern/public/docs');
+ const article = document.createElement('article');
+ article.innerHTML = renderDocMarkdown(readFileSync(path.join(root, `${name}.md`), 'utf8'), name);
+ return article;
+}
+
+function section(name: string, id: string): HTMLElement {
+ const heading = guide(name).querySelector(`#${id}`);
+ expect(heading).not.toBeNull();
+ const result = document.createElement('section');
+ for (let next = heading!.nextElementSibling; next; next = next.nextElementSibling) {
+ if (/^H[1-6]$/.test(next.tagName)) break;
+ result.appendChild(next.cloneNode(true));
+ }
+ return result;
+}
+
+const prose = (element: HTMLElement): string =>
+ (element.textContent ?? '').replace(/\s+/g, ' ').trim();
+
+describe('shipped CORS guidance', () => {
+ it('does not prescribe a wildcard for a proxy or login problem', () => {
+ const text = prose(section('FAQ', 'cors-errors'));
+ expect(text).toContain('same public origin, including behind a reverse proxy');
+ expect(text).toContain('allow only its exact origin (scheme, host and port)');
+ expect(text).toContain('* is not a login or proxy repair');
+ expect(text).not.toContain('if you explicitly want all origins');
+ });
+
+ it('separates browser origin checks from platform connections and other failures', () => {
+ const text = prose(section('TROUBLESHOOTING', 'cors-errors'));
+ expect(text).toContain("not Pulse's connection to Proxmox, PBS or TrueNAS");
+ expect(text).toContain("API request's origin and HTTP status");
+ expect(text).toContain('certificate failure, login redirect or 401/403');
+ expect(text).toContain('not a broader CORS allowlist');
+ expect(text).toContain('do not expose the backend or add wildcard response headers');
+ });
+
+ it('describes exact origins, effective overrides and saved-value verification', () => {
+ const element = section('TROUBLESHOOTING', 'cors-errors');
+ const text = prose(element);
+ expect(text).toContain('scheme, host and port');
+ expect(text).toContain('Do not include a path, trailing slash or a hostname pattern');
+ expect(text).toContain('Multiple exact origins are comma-separated');
+ expect(text).toContain('removing that environment override does not erase');
+ expect(text).toContain('verify the effective value and the ordinary browser request');
+ expect(
+ [...element.querySelectorAll('code')].some(
+ (code) => code.textContent === 'https://app.example.com:8443',
+ ),
+ ).toBe(true);
+ });
+
+ it('keeps session credentials and security protections out of wildcard workarounds', () => {
+ const text = prose(section('TROUBLESHOOTING', 'cors-errors'));
+ expect(text).toContain('without credentialed browser access');
+ expect(text).toContain('cannot fix a request that needs a browser session cookie');
+ expect(text).toContain('Do not disable authentication, CSRF protection or TLS verification');
+ expect(text).toContain('Iframe embedding and proxy authentication have separate settings');
+ expect(text).toContain('empty policy grants no cross-origin browser permission');
+ });
+
+ it('does not ask for credential-bearing network exports or commands', () => {
+ const element = section('TROUBLESHOOTING', 'cors-errors');
+ const text = prose(element);
+ expect(text).toContain(
+ 'Keep cookies, authorization headers, API tokens and full network exports private',
+ );
+ expect(text).toContain('redacted error, HTTP status and relevant origins');
+ expect(text).toContain('not a credential-bearing request or HAR file');
+ expect(element.querySelector('pre')).toBeNull();
+ });
+
+ it('makes the configuration reference and proxy guide agree with exact-origin policy', () => {
+ const rows = [...guide('CONFIGURATION').querySelectorAll('tbody tr')];
+ for (const key of ['allowedOrigins', 'ALLOWED_ORIGINS']) {
+ const row = rows.find((candidate) => candidate.querySelector('td code')?.textContent === key);
+ expect(row).toBeDefined();
+ expect(prose(row as HTMLElement)).toContain('comma-separated exact origins');
+ expect(prose(row as HTMLElement)).toMatch(
+ /without credentials|without credentialed browser access/,
+ );
+ }
+ expect(prose(guide('REVERSE_PROXY'))).toContain(
+ 'same-origin reverse proxy needs no CORS exception',
+ );
+ });
+
+ it('resolves CORS and proxy links to real shipped headings', () => {
+ const links = [
+ ...section('FAQ', 'cors-errors').querySelectorAll('a[href]'),
+ ...section('TROUBLESHOOTING', 'cors-errors').querySelectorAll('a[href]'),
+ ...section('REVERSE_PROXY', 'before-configuring-the-proxy').querySelectorAll('a[href]'),
+ ];
+ expect(links.length).toBeGreaterThanOrEqual(4);
+ for (const link of links) {
+ const href = link.getAttribute('href')!;
+ const match = /^\/docs\/([^#]+)(#.+)$/.exec(href);
+ if (!match) continue;
+ expect(guide(match[1]).querySelector(match[2]), href).not.toBeNull();
+ expect(link.hasAttribute('data-doc-link')).toBe(true);
+ expect(link.hasAttribute('target')).toBe(false);
+ }
+ });
+
+ it('ships identical canonical and served guides', () => {
+ for (const name of names) {
+ expect(
+ readFileSync(path.join(repoRoot, 'frontend-modern/public/docs', `${name}.md`), 'utf8'),
+ ).toBe(readFileSync(path.join(repoRoot, 'docs', `${name}.md`), 'utf8'));
+ }
+ });
+});