Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b70a87669 | ||
|
|
ead07ef932 | ||
|
|
d8312f4b33 | ||
|
|
a9239d429a | ||
|
|
405b5f1b92 | ||
|
|
c8c5db46bc | ||
|
|
031fb11e02 | ||
|
|
16d3ffe6ba |
@@ -2,6 +2,19 @@
|
||||
|
||||
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
|
||||
|
||||
## events@3.6.1 - 2026-11-20
|
||||
|
||||
- **Events 3.6.1 (fix):** uploading a logo or favicon failed with "uploaded, but the site can't
|
||||
show it yet" behind a proxy with a file-extension rule (FastPanel's static-file handling sent
|
||||
`/api/uploads/…png` to the frontend). The site now passes `/api/*` and `/uploads/*` that reach
|
||||
it on to the backend (new `BACKEND_INTERNAL_URL`, added on deploy).
|
||||
- **crosscode script:** the nginx site it writes uses `location ^~ /api/` and `^~ /uploads/`.
|
||||
|
||||
## accounts@1.6.0 - 2026-11-20
|
||||
|
||||
- **Accounts 1.6.0:** a "New sign-in" email (and WhatsApp for a verified number) after every
|
||||
sign-in, as Cross Events' own sign-in did; Sign-in settings → `signin_notices` turns it off.
|
||||
|
||||
## events@3.6.0, accounts@1.5.0, contracts@1.14.0 - 2026-11-20
|
||||
|
||||
A nightly check that each site's copies of people match their church accounts, for changes that
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# Changelog — Accounts
|
||||
|
||||
## [1.6.0] - 2026-11-20
|
||||
|
||||
### Added
|
||||
|
||||
- **"New sign-in" notices**, as Cross Events' own sign-in sends (`src/accounts/signInNotice.ts`):
|
||||
after each completed sign-in (the interaction reaching done, so not the silent ones a second
|
||||
product gets from an existing session), an email with when, the site, rough location and device
|
||||
(`newSignInEmail` in `src/lib/emails.ts`), and a WhatsApp message when the person has a verified
|
||||
number and WhatsApp is set up. Location from ip-api.com in production only, never for private
|
||||
addresses. Fire-and-forget: never holds up or fails a sign-in. Admins can turn it off:
|
||||
`signin_notices` (Sign-in settings, on by default). In Accounts mode Cross Events no longer sends
|
||||
its own, so before this nobody was told.
|
||||
|
||||
## [1.5.0] - 2026-11-20
|
||||
|
||||
Needs contracts 1.14.0.
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
What each version changes for the church, in plain language (read by the Hub like Cross Events'
|
||||
WHATS-NEW.md; a section shows once its version is tagged).
|
||||
|
||||
## 1.6.0
|
||||
|
||||
- **You're told about each sign-in.** After someone signs in, they get an email saying when, roughly
|
||||
where, on what device and to which site, with what to do if it wasn't them, as Cross Events
|
||||
does for its own sign-in. People with a confirmed WhatsApp number get it on WhatsApp too.
|
||||
Admins can turn this off under Sign-in settings.
|
||||
|
||||
## 1.5.0
|
||||
|
||||
- Your church's sites can now check every night that the details they keep for each person match
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/accounts-backend",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"description": "Cross Code Accounts: the church's sign-in (OpenID Connect provider), account pages API and admin API",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* "New sign-in" notices (1.6.0), as Cross Events sends for its own sign-in: after each completed
|
||||
* sign-in, an email to the person, and a WhatsApp message too when they have a verified number and
|
||||
* WhatsApp is set up. Admins can turn them off (Sign-in settings, `signin_notices`). Never holds up
|
||||
* or fails the sign-in.
|
||||
*
|
||||
* The rough location comes from the IP (ip-api.com, as Cross Events), in production only, and never
|
||||
* for private addresses.
|
||||
*/
|
||||
import type { Ctx } from '../context.js';
|
||||
import { newSignInEmail } from '../lib/emails.js';
|
||||
import { productName } from '../oidc/clients.js';
|
||||
|
||||
const PRIVATE_IP = /^(::1$|127\.|10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.|fc|fd|fe80|::ffff:(127|10|192\.168)\.)/i;
|
||||
|
||||
/** "Chrome on Windows" from a user agent; the raw string when it can't tell. */
|
||||
export function describeDevice(ua: string | null | undefined): string {
|
||||
const s = String(ua || '');
|
||||
if (!s) return 'Unknown device';
|
||||
const browser = /Edg\//.test(s) ? 'Edge' : /OPR\/|Opera/.test(s) ? 'Opera' : /Firefox\//.test(s) ? 'Firefox'
|
||||
: /SamsungBrowser\//.test(s) ? 'Samsung Internet' : /Chrome\//.test(s) ? 'Chrome' : /Safari\//.test(s) ? 'Safari' : null;
|
||||
const os = /iPhone|iPad|iPod/.test(s) ? 'iPhone or iPad' : /Android/.test(s) ? 'Android' : /Windows/.test(s) ? 'Windows'
|
||||
: /Mac OS X|Macintosh/.test(s) ? 'a Mac' : /CrOS/.test(s) ? 'a Chromebook' : /Linux/.test(s) ? 'Linux' : null;
|
||||
if (browser && os) return `${browser} on ${os}`;
|
||||
return browser || os || s.slice(0, 120);
|
||||
}
|
||||
|
||||
async function roughLocation(ctx: Ctx, ip: string | null): Promise<string> {
|
||||
if (!ip || PRIVATE_IP.test(ip) || !ctx.config.production) return 'Unknown';
|
||||
try {
|
||||
const res = await fetch(`http://ip-api.com/json/${encodeURIComponent(ip.replace(/^::ffff:/, ''))}?fields=status,city,regionName,country`, { signal: AbortSignal.timeout(3000) });
|
||||
const geo = (await res.json()) as { status?: string; city?: string; regionName?: string; country?: string };
|
||||
const parts = geo.status === 'success' ? [geo.city, geo.regionName, geo.country].filter(Boolean) : [];
|
||||
return parts.length ? parts.join(', ') : 'Unknown';
|
||||
} catch {
|
||||
return 'Unknown';
|
||||
}
|
||||
}
|
||||
|
||||
export async function sendSignInNotice(ctx: Ctx, o: { accountId: string; ip: string | null; userAgent: string | null; clientId: string | null }): Promise<'sent' | 'off' | 'failed'> {
|
||||
try {
|
||||
if (!(await ctx.settings.bool('signin_notices', true))) return 'off';
|
||||
const a = await ctx.db.account.findUnique({ where: { id: o.accountId } });
|
||||
if (!a || a.status !== 'active') return 'off';
|
||||
const link = o.clientId ? await ctx.db.productLink.findUnique({ where: { installId: o.clientId } }) : null;
|
||||
const site = link ? productName(link.product) : o.clientId === 'accounts-self' ? 'Your account page' : null;
|
||||
const when = ctx.now().toLocaleString('en-ZA', { timeZone: ctx.config.timezone, dateStyle: 'medium', timeStyle: 'short' });
|
||||
const msg = await newSignInEmail(ctx, { name: a.name, when, location: await roughLocation(ctx, o.ip), device: describeDevice(o.userAgent), site });
|
||||
await ctx.messenger.email({ to: a.email, subject: msg.subject, text: msg.text, html: msg.html });
|
||||
if (a.phone && a.phoneVerified && (await ctx.messenger.whatsappReady())) {
|
||||
await ctx.messenger.whatsapp({ to: a.phone, text: msg.whatsapp }).catch((e: Error) => console.warn('[sign-in notice] WhatsApp:', e.message));
|
||||
}
|
||||
return 'sent';
|
||||
} catch (e) {
|
||||
console.warn('[sign-in notice] not sent:', (e as Error).message);
|
||||
return 'failed';
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,8 @@ import type Provider from 'oidc-provider';
|
||||
import { decodeState, encodeState, safeReturnPath } from '@crosscode/contracts';
|
||||
import type { Ctx } from '../context.js';
|
||||
import { ApiError, handle, limit } from '../http.js';
|
||||
import { loginEvent } from '../lib/audit.js';
|
||||
import { clientIp, loginEvent } from '../lib/audit.js';
|
||||
import { sendSignInNotice } from '../accounts/signInNotice.js';
|
||||
import { resetPasswordEmail } from '../lib/emails.js';
|
||||
import { hashToken, randomToken } from '../lib/crypto.js';
|
||||
import { hashPassword, passwordProblem } from '../lib/passwords.js';
|
||||
@@ -44,6 +45,8 @@ export function interactionRouter(ctx: Ctx, provider: Provider) {
|
||||
const clientId = String(details.params.client_id ?? '') || null;
|
||||
await loginEvent(ctx, pending.accountId, 'sign_in', req, { clientId, detail: { amr: pending.amr } });
|
||||
await signedInThrough(ctx, clientId, pending.accountId);
|
||||
// 1.6.0: "New sign-in" email (and WhatsApp), as Cross Events; never waited for.
|
||||
if (pending.accountId) void sendSignInNotice(ctx, { accountId: pending.accountId, ip: clientIp(req), userAgent: req.get('user-agent') ?? null, clientId });
|
||||
await ctx.db.pendingSignIn.deleteMany({ where: { uid: pending.uid } });
|
||||
return { stage: 'done', redirectTo, ...extra };
|
||||
}
|
||||
|
||||
@@ -206,3 +206,20 @@ export async function testEmail(ctx: Ctx, o: { from?: string } = {}): Promise<Bu
|
||||
: 'Email from Accounts works.';
|
||||
return { subject: o.from ? `Test email from ${b.name}'s sign-in` : 'Test email from Accounts', text, html: layout(b, body, 'A test email: email works.') };
|
||||
}
|
||||
|
||||
/** A sign-in happened (1.6.0, as Cross Events' "New login detected"). `whatsapp`: the same in a few lines. */
|
||||
export async function newSignInEmail(ctx: Ctx, o: { name?: string | null; when: string; location: string; device: string; site: string | null }): Promise<Built & { whatsapp: string }> {
|
||||
const b = await brand(ctx);
|
||||
const row = (k: string, v: string) => `<tr><td style="padding:10px 14px;border-top:1px solid #f1f5f9;color:#64748b;font-size:13px;font-weight:600;width:34%">${esc(k)}</td><td style="padding:10px 14px;border-top:1px solid #f1f5f9;color:#1e293b;font-size:14px;word-break:break-word">${esc(v)}</td></tr>`;
|
||||
const body = title('New sign-in', `Someone signed in to your ${b.name} account`)
|
||||
+ hello(o.name)
|
||||
+ `<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="border:1px solid #e2e8f0;border-radius:8px;overflow:hidden;margin:0 0 8px 0">`
|
||||
+ row('When', o.when) + (o.site ? row('Signed in to', o.site) : '') + row('Where (roughly)', o.location) + row('Device', o.device)
|
||||
+ '</table>'
|
||||
+ callout(`<strong>Not you?</strong> Change your password straight away from your account page, and let the church office know${contactLine(b)}.`, 'warning')
|
||||
+ small('If this was you, there\'s nothing to do.');
|
||||
const lines = [`When: ${o.when}`, ...(o.site ? [`Signed in to: ${o.site}`] : []), `Where (roughly): ${o.location}`, `Device: ${o.device}`];
|
||||
const text = `Hello ${o.name || 'there'},\n\nSomeone signed in to your ${b.name} account.\n\n${lines.join('\n')}\n\nIf this wasn't you, change your password straight away and let the church office know${b.email ? ` (${b.email})` : ''}.\nIf it was you, there's nothing to do.`;
|
||||
const whatsapp = `🔐 *New sign-in*\n\nHello ${o.name || 'there'}, someone signed in to your *${b.name}* account.\n\n${lines.join('\n')}\n\nNot you? Change your password straight away and let the church office know.`;
|
||||
return { subject: `New sign-in to your ${b.name} account`, text, html: layout(b, body, `New sign-in: ${o.when}, ${o.device}.`), whatsapp };
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export const SECRET_SETTINGS = new Set(['smtp_pass', 'wawp_access_token', 'hub_i
|
||||
|
||||
/** The settings an admin may read and change through the generic settings API. */
|
||||
export const ADMIN_SETTINGS = new Set([
|
||||
'signup_enabled', 'two_factor_required_for_admins', 'session_days',
|
||||
'signup_enabled', 'two_factor_required_for_admins', 'session_days', 'signin_notices',
|
||||
'smtp_host', 'smtp_port', 'smtp_user', 'smtp_pass', 'smtp_from', 'smtp_secure',
|
||||
'wawp_access_token', 'wawp_instance_id',
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// 1.6.0: a "New sign-in" email (and WhatsApp) after each sign-in, as Cross Events sends.
|
||||
import assert from 'node:assert/strict';
|
||||
import { after, before, describe, test } from 'node:test';
|
||||
import { startHarness, type Harness } from './support/harness.js';
|
||||
import { describeDevice, sendSignInNotice } from '../src/accounts/signInNotice.js';
|
||||
import type { MemoryMessenger } from '../src/lib/messages.js';
|
||||
|
||||
let h: Harness;
|
||||
before(async () => { h = await startHarness(); });
|
||||
after(async () => { await h.close(); });
|
||||
|
||||
const CHROME_WIN = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0 Safari/537.36';
|
||||
|
||||
describe('sign-in notices', () => {
|
||||
test('an email with when, where, the device and the site; WhatsApp too for a verified number', async () => {
|
||||
const m = h.ctx.messenger as MemoryMessenger;
|
||||
const a = await h.makeAccount({ email: 'notice.person@hope.test' });
|
||||
assert.equal(await sendSignInNotice(h.ctx, { accountId: a.id as string, ip: '127.0.0.1', userAgent: CHROME_WIN, clientId: 'accounts-self' }), 'sent');
|
||||
const mail = m.emails.filter((e) => e.to === 'notice.person@hope.test').at(-1)!;
|
||||
assert.match(mail.subject, /^New sign-in to your .+ account$/);
|
||||
assert.match(mail.text, /Device: Chrome on Windows/);
|
||||
assert.match(mail.text, /Signed in to: Your account page/);
|
||||
assert.match(mail.html ?? '', /Not you\?/);
|
||||
|
||||
await h.db.account.update({ where: { id: a.id as string }, data: { phone: '+27821234567', phoneVerified: true } });
|
||||
m.whatsappOn = true;
|
||||
const before = m.whatsapps.length;
|
||||
await sendSignInNotice(h.ctx, { accountId: a.id as string, ip: null, userAgent: null, clientId: null });
|
||||
assert.equal(m.whatsapps.length, before + 1);
|
||||
assert.match(m.whatsapps.at(-1)!.text, /New sign-in/);
|
||||
m.whatsappOn = false;
|
||||
});
|
||||
|
||||
test('admins can switch them off; a failing email never throws', async () => {
|
||||
const m = h.ctx.messenger as MemoryMessenger;
|
||||
const a = await h.makeAccount({ email: 'notice.off@hope.test' });
|
||||
await h.ctx.settings.set('signin_notices', 'false');
|
||||
assert.equal(await sendSignInNotice(h.ctx, { accountId: a.id as string, ip: null, userAgent: null, clientId: null }), 'off');
|
||||
await h.ctx.settings.set('signin_notices', null);
|
||||
m.emailOn = false;
|
||||
assert.equal(await sendSignInNotice(h.ctx, { accountId: a.id as string, ip: null, userAgent: null, clientId: null }), 'failed');
|
||||
m.emailOn = true;
|
||||
});
|
||||
|
||||
test('device names', () => {
|
||||
assert.equal(describeDevice(CHROME_WIN), 'Chrome on Windows');
|
||||
assert.equal(describeDevice('Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 Version/17.0 Mobile/15E148 Safari/604.1'), 'Safari on iPhone or iPad');
|
||||
assert.equal(describeDevice(null), 'Unknown device');
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/accounts-frontend",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"private": true,
|
||||
"description": "Cross Code Accounts: the church's sign-in pages, the account page and admin",
|
||||
"scripts": {
|
||||
|
||||
@@ -57,7 +57,7 @@ export function Admin({ section = "people" }: { section?: AdminSection }) {
|
||||
{section === "deletions" && <Deletions flash={flash} />}
|
||||
{section === "church" && <Church flash={flash} />}
|
||||
{section === "linked" && <Linked flash={flash} />}
|
||||
{section === "signin" && <Settings flash={flash} keys={["signup_enabled", "two_factor_required_for_admins", "session_days"]} />}
|
||||
{section === "signin" && <Settings flash={flash} keys={["signup_enabled", "two_factor_required_for_admins", "signin_notices", "session_days"]} />}
|
||||
{section === "messages" && <Settings flash={flash} keys={["smtp_host", "smtp_port", "smtp_user", "smtp_pass", "smtp_from", "smtp_secure", "wawp_access_token", "wawp_instance_id"]} />}
|
||||
{section === "notice" && <NoticeTab flash={flash} />}
|
||||
{section === "backups" && <Backups flash={flash} />}
|
||||
@@ -252,6 +252,7 @@ function Linked({ flash }: { flash: Flash }) {
|
||||
const SETTING_LABELS: Record<string, [string, "bool" | "text" | "secret" | "number"]> = {
|
||||
signup_enabled: ["Members can create their own account", "bool"],
|
||||
two_factor_required_for_admins: ["Admins must use two-step sign-in", "bool"],
|
||||
signin_notices: ["Tell people by email (and WhatsApp) each time they sign in", "bool"],
|
||||
session_days: ['Days "Keep me signed in" lasts', "number"],
|
||||
smtp_host: ["SMTP server", "text"], smtp_port: ["SMTP port", "number"], smtp_user: ["SMTP user name", "text"], smtp_pass: ["SMTP password", "secret"],
|
||||
smtp_from: ["Send from (email address)", "text"], smtp_secure: ["Use TLS from the start (port 465)", "bool"],
|
||||
@@ -266,7 +267,7 @@ function Settings({ flash, keys }: { flash: Flash; keys: string[] }) {
|
||||
return () => { alive = false; };
|
||||
}, []);
|
||||
if (!values) return <p className="text-gray-600">Loading…</p>;
|
||||
const defaults: Record<string, boolean> = { signup_enabled: true, two_factor_required_for_admins: true };
|
||||
const defaults: Record<string, boolean> = { signup_enabled: true, two_factor_required_for_admins: true, signin_notices: true };
|
||||
return (
|
||||
<Card>
|
||||
<form onSubmit={async (e) => {
|
||||
|
||||
@@ -5,6 +5,23 @@ All notable changes to this project are documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project follows [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [3.6.1] - 2026-11-20
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Uploading a logo or favicon under Settings → Branding failed on some servers** with "The logo was
|
||||
uploaded, but the site can't show it yet". The upload worked, but on a server whose proxy has a
|
||||
rule for file extensions (static-file caching) every `/api/…` path ending in `.png`, `.ico`,
|
||||
`.pdf`, `.json` and so on went to the site (Next.js), which answered 404. So the check after the
|
||||
upload failed, as did pictures, certificate PDFs and `/api/v2/openapi.json`. Two changes:
|
||||
- The site passes `/api/*` and `/uploads/*` that reach it on to the backend
|
||||
(`next.config.ts` rewrites, `beforeFiles`). New frontend setting `BACKEND_INTERNAL_URL`
|
||||
(`http://127.0.0.1:<apiPort>`, added to `.env.production` on deploy). Unset, nothing is
|
||||
passed on, as before. The end-to-end tests' `E2E_API_PROXY` uses the same rewrites.
|
||||
- The nginx site the installers write (and DEPLOYMENT.md) sends `/api/` and `/uploads/` to the
|
||||
backend with `location ^~`, so no regex location can take them. Existing servers keep their
|
||||
nginx file: change it by hand (DEPLOYMENT.md §4).
|
||||
|
||||
## [3.6.0] - 2026-11-20
|
||||
|
||||
Works with any Accounts; the people check needs Accounts 1.5.0 (with an older one it's skipped).
|
||||
|
||||
+26
-15
@@ -127,13 +127,17 @@ server {
|
||||
access_log /var/log/nginx/hope-events.access.log hope_proxy;
|
||||
|
||||
# Visitors only reach this through the VPS over HTTPS, so tell the app so.
|
||||
location ~ ^/(api|uploads|health|docs)(/|$) {
|
||||
proxy_pass http://127.0.0.1:5000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
# For the backend locations below ("location /" sets its own).
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
|
||||
# The API and uploaded files go to the backend. Keep the ^~: without it, any regex location
|
||||
# (e.g. one that caches *.png or *.css) wins and sends /api/uploads/…/logo.png to the site.
|
||||
location ^~ /api/ { proxy_pass http://127.0.0.1:5000; }
|
||||
location ^~ /uploads/ { proxy_pass http://127.0.0.1:5000; }
|
||||
location ~ ^/(api|uploads|health|docs)(/|$) { proxy_pass http://127.0.0.1:5000; }
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_http_version 1.1;
|
||||
@@ -147,7 +151,10 @@ server {
|
||||
```
|
||||
|
||||
The VPS nginx/Caddy must redirect plain HTTP to HTTPS and pass the `Host` header through to frps
|
||||
unchanged (frps picks the site by its host name). For nginx on the VPS, roughly:
|
||||
unchanged (frps picks the site by its host name). Send every path through as it is: no
|
||||
`location ~* \.(png|css|js…)$` caching rules for this site on the VPS, which would send
|
||||
`/api/uploads/…/logo.png` to the site instead of the backend. (Since 3.6.1 the site passes such
|
||||
requests on to the backend itself, but they're slower that way.) For nginx on the VPS, roughly:
|
||||
|
||||
```nginx
|
||||
server {
|
||||
@@ -188,13 +195,17 @@ server {
|
||||
client_max_body_size 25m;
|
||||
access_log /var/log/nginx/hope-events.access.log hope_proxy;
|
||||
|
||||
location ~ ^/(api|uploads|health|docs)(/|$) {
|
||||
proxy_pass http://127.0.0.1:5000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
# For the backend locations below ("location /" sets its own).
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
|
||||
# The API and uploaded files go to the backend. Keep the ^~: without it, any regex location
|
||||
# (e.g. one that caches *.png or *.css) wins and sends /api/uploads/…/logo.png to the site.
|
||||
location ^~ /api/ { proxy_pass http://127.0.0.1:5000; }
|
||||
location ^~ /uploads/ { proxy_pass http://127.0.0.1:5000; }
|
||||
location ~ ^/(api|uploads|health|docs)(/|$) { proxy_pass http://127.0.0.1:5000; }
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3000;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
@@ -12,6 +12,12 @@ Write for church admins, not developers: no environment variables, endpoints or
|
||||
developer log is CHANGELOG.md. A tagged version without a section here shows "No details given".
|
||||
-->
|
||||
|
||||
## 3.6.1
|
||||
|
||||
- **Fix:** uploading a logo or site icon under Settings → Branding could fail with "uploaded, but
|
||||
the site can't show it yet", depending on how the server is set up. Uploaded pictures, certificate
|
||||
downloads and the like now show on those servers too.
|
||||
|
||||
## 3.6.0
|
||||
|
||||
- **People's details are checked every night.** Cross Events compares everyone's name, email,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/events-backend",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"description": "Event Management System Backend",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -108,6 +108,12 @@
|
||||
"layer": "install",
|
||||
"from": "https://{domain}",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "BACKEND_INTERNAL_URL",
|
||||
"layer": "install",
|
||||
"from": "http://127.0.0.1:{apiPort}",
|
||||
"description": "The backend on this server: requests for /api or /uploads that reach the site are passed to it (3.6.1)"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
import type { NextConfig } from "next";
|
||||
import { withSentryConfig } from "@sentry/nextjs";
|
||||
|
||||
// Requests for the backend (/api, /uploads) that reach the site anyway are passed to it (3.6.1).
|
||||
// On a server nginx sends those paths to the backend, but a proxy in front can send some to the
|
||||
// site instead: one with a rule for file extensions (static-file caching) sent every
|
||||
// /api/uploads/…png here, so an uploaded logo never showed. BACKEND_INTERNAL_URL is the backend on
|
||||
// this server (http://127.0.0.1:<port>), never the public address, which would come straight back
|
||||
// here. The end-to-end tests set E2E_API_PROXY (3.0.0): the site and its API on one address, as
|
||||
// nginx does, so Accounts' sign-in comes back to <site>/api/auth/callback.
|
||||
const backend = (process.env.BACKEND_INTERNAL_URL || process.env.E2E_API_PROXY || "").replace(/\/+$/, "");
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
// The end-to-end tests run their own dev server; a separate build folder keeps it
|
||||
// from clashing with one already running.
|
||||
@@ -12,10 +21,20 @@ const nextConfig: NextConfig = {
|
||||
compiler: {
|
||||
removeConsole: process.env.NODE_ENV === 'production',
|
||||
},
|
||||
// The end-to-end tests only (3.0.0): the site and its API on one address, as nginx does on a
|
||||
// server, so Accounts' sign-in comes back to <site>/api/auth/callback. Unset everywhere else.
|
||||
...(process.env.E2E_API_PROXY
|
||||
? { async rewrites() { return [{ source: '/api/:path*', destination: `${process.env.E2E_API_PROXY}/api/:path*` }]; } }
|
||||
...(backend
|
||||
? {
|
||||
// beforeFiles: ahead of every page, so a dynamic route like /[redirectUrl] never catches them.
|
||||
async rewrites() {
|
||||
return {
|
||||
beforeFiles: [
|
||||
{ source: '/api/:path*', destination: `${backend}/api/:path*` },
|
||||
{ source: '/uploads/:path*', destination: `${backend}/uploads/:path*` },
|
||||
],
|
||||
afterFiles: [],
|
||||
fallback: [],
|
||||
};
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/events-frontend",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/events",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev:backend": "cd backend && npm run dev",
|
||||
|
||||
@@ -116,7 +116,7 @@ else
|
||||
echo " backend/.env exists — kept"
|
||||
fi
|
||||
if [ ! -f "$DIR/frontend/.env.production" ]; then
|
||||
echo "NEXT_PUBLIC_API_URL=$SITE_URL" > "$DIR/frontend/.env.production"
|
||||
printf 'NEXT_PUBLIC_API_URL=%s\nBACKEND_INTERNAL_URL=http://127.0.0.1:%s\n' "$SITE_URL" "$API_PORT" > "$DIR/frontend/.env.production"
|
||||
fi
|
||||
if [ ! -f "$DIR/ecosystem.config.js" ]; then
|
||||
sed -e "s/'hope-events-backend'/'$NAME-backend'/" -e "s/'hope-events-frontend'/'$NAME-frontend'/" -e "s/-p 3000/-p $WEB_PORT/" \
|
||||
@@ -140,14 +140,17 @@ server {
|
||||
server_name $DOMAIN;
|
||||
client_max_body_size 25m;
|
||||
|
||||
# For the backend locations below ("location /" sets its own).
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
|
||||
# The API, uploaded files, health and API docs go to the backend; everything else to the site.
|
||||
location ~ ^/(api|uploads|health|docs)(/|\$) {
|
||||
proxy_pass http://127.0.0.1:$API_PORT;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
}
|
||||
# ^~ so a regex location added later (e.g. caching *.png) can't send /api/…/logo.png to the site.
|
||||
location ^~ /api/ { proxy_pass http://127.0.0.1:$API_PORT; }
|
||||
location ^~ /uploads/ { proxy_pass http://127.0.0.1:$API_PORT; }
|
||||
location ~ ^/(api|uploads|health|docs)(/|\$) { proxy_pass http://127.0.0.1:$API_PORT; }
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:$WEB_PORT;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
+74
-11
@@ -1,6 +1,6 @@
|
||||
# Handover — Cross Code, all products
|
||||
|
||||
Last updated: 2026-11-19. **The plan is [ROADMAP-v3.md](./ROADMAP-v3.md)** (decided 2026-11-03,
|
||||
Last updated: 2026-11-20. **The plan is [ROADMAP-v3.md](./ROADMAP-v3.md)** (decided 2026-11-03,
|
||||
decisions table near the end). This file says where each phase stands and what comes next.
|
||||
Product-specific notes (where the code lives, known gaps) stay with each product: Cross Events'
|
||||
are in [`apps/events/docs/HANDOVER.md`](../apps/events/docs/HANDOVER.md), and the Hub's are in
|
||||
@@ -33,20 +33,70 @@ every release).
|
||||
| 2 | Cross Events 2.4.0: protocol v2, Linked products, event feed, `packages/seo` (+ contracts 1.4.0, Hub 2.2.0) | **Released** 2026-11-18 (`events@2.4.0`, `contracts@1.4.0`, Hub `v2.2.0`, crosscode-site `v1.4.0`; [EVENTS-2.4-PLAN.md](./EVENTS-2.4-PLAN.md)). **Before any church gets it:** the Events e2e run on Postgres and the VM test (EVENTS-2.4-PLAN §8) |
|
||||
| 3 | Accounts 1.0.0 (+ contracts 1.5.0, agent 1.1.0, Hub 2.3.0) | **Released** 2026-11-18 (`accounts@1.0.0`, `contracts@1.5.0`, `agent@1.1.0`, Hub `v2.3.0`, crosscode-site `v1.5.0`; [ACCOUNTS-1.0-PLAN.md](./ACCOUNTS-1.0-PLAN.md)). 37 backend and 8 Playwright tests pass without Postgres. **Before installing it for a church:** the VM test and a run on real Postgres; a Hub release source for `accounts@` tags |
|
||||
| 4 | Cross Events 3.0.0: sign-in through Accounts, users migrated with their password hashes and 2FA | **Released** 2026-11-19 (`events@3.0.0`, `accounts@1.1.0`, `contracts@1.8.0`, Hub `v2.5.0`, crosscode-site `v1.6.0`; [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md)). Tested on Postgres 18: both migrations, `test:accounts` on real databases (14/14), the Events e2e suite (111, incl. `sign-in-accounts.spec.ts`). **Not VM tested yet.** Roll out: Hub 2.5.0 deployed first, then per church Accounts 1.1.0 → Events 3.0 → Move (MIGRATING-TO-3.md); crosscode-site 1.6.0 once the first church has moved |
|
||||
| 4+ | Running it: jobs from the dashboard, styled Accounts emails, .env from the Hub, sign-in health, the nightly people check | **Released** 2026-11-20 (see below). Unit, bats and full `npm run check` passing; **not VM tested, not deployed** |
|
||||
| 5–7 | Website 1.0.0 → App 1.0.0 → App 1.x | Not started |
|
||||
|
||||
## Released 2026-11-20
|
||||
|
||||
All tagged and pushed; nothing deployed yet. Details in [CHANGELOG.md](../CHANGELOG.md), the apps' CHANGELOGs
|
||||
and What's New, and [VERSIONS.md](./VERSIONS.md).
|
||||
|
||||
| Release | What |
|
||||
|---------|------|
|
||||
| `events@3.4.0`, `accounts@1.4.0`, `contracts@1.12.0`, `agent@1.3.0`, Hub `v2.8.0` | Background jobs switched on/off and rescheduled from each site's admin (saved in `job_overrides`, wins over the .env, applies at once; Accounts gets an Admin → Background jobs page). Accounts' emails styled as Events' (`src/lib/emails.ts`). The Hub reads and changes an install's .env (`env-read` / `env-set` jobs → `crosscode env`; secrets never leave the server; the file is put back if the site doesn't start; the frontend's file triggers a rebuild) |
|
||||
| `events@3.5.0`, `contracts@1.13.0`, `agent@1.3.1`, Hub `v2.9.0` | **Fix:** "Load demo data" deleted the Accounts link (`set-demo.js` truncated `ProductLink`), so events-demo couldn't sign anyone in (`ACCOUNTS_UNAVAILABLE`). Demo data keeps the link; a site in Accounts mode without a link reconnects at its next heartbeat. Heartbeat `stats.signIn`; Hub alerts: not linked (critical), wrong Accounts, sign-in failing, an Accounts nothing links to. **Agent 1.3.0 reported itself as 1.2.0**: use 1.3.1 |
|
||||
| `accounts@1.6.0` | A "New sign-in" email (and WhatsApp) after every sign-in; Sign-in settings → `signin_notices` turns it off |
|
||||
| `events@3.6.1` | **Fix:** logo/favicon uploads failed on events-demo ("uploaded, but the site can't show it yet"). FastPanel's static-file rule sent every `/api/…` path with a file extension (`.png`, `.pdf`, …) to the frontend. The site now passes `/api/*` and `/uploads/*` on to the backend (`BACKEND_INTERNAL_URL`); the installers' nginx uses `location ^~`. Change each FastPanel site too (below) |
|
||||
| `events@3.6.0`, `accounts@1.5.0`, `contracts@1.14.0` | The nightly people check (`accounts-people-check`, 04:30): `people.check` 500 subs at a time; fixes out-of-date copies, handles deleted accounts as `user.deleted`, stops (changing nothing) when most people are unknown. Skipped with an Accounts before 1.5.0 |
|
||||
|
||||
**To fix events-demo before it's updated:** its Settings → Linked products → Connect the church's
|
||||
Accounts (or update it to Events 3.5.0+, which reconnects within ~15 minutes).
|
||||
|
||||
## FastPanel sites (central server)
|
||||
|
||||
FastPanel's nginx on the central server is the only router for sites behind frp: the church
|
||||
server has no nginx. Its static-file handling adds a regex location for file extensions
|
||||
(`png|jpg|ico|svg|css|js|pdf|txt|…`) that falls back to the site's main proxy, the frontend. A
|
||||
plain `location /api` loses to it, so `/api/uploads/…/logo.png` reached Next.js and got a 404
|
||||
(fixed in the site by Events 3.6.1, but slower and without the visitor's IP). In each Events
|
||||
site's nginx config in FastPanel, the backend locations must be `^~` (a prefix match that no
|
||||
regex can override):
|
||||
|
||||
```nginx
|
||||
location ^~ /api/ {
|
||||
proxy_pass http://127.0.0.1:<api port>;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
}
|
||||
location = /api { proxy_pass http://127.0.0.1:<api port>; }
|
||||
```
|
||||
|
||||
The Hub's FastPanel email (AGENT-1.0-PLAN §11) still says just "/api → backend": it should say
|
||||
`location ^~ /api/`. Check after a change:
|
||||
`curl -sI https://<domain>/api/health.png` must say `X-Powered-By: Express` (a 404 is fine).
|
||||
|
||||
## Next up
|
||||
|
||||
1. **Roll out**, in the order in [ROLLOUT-1.0.md](./ROLLOUT-1.0.md) (with the latest patch
|
||||
releases: Hub 2.1.1, agent 1.0.1, Events 2.3.1): Hub 2.1 (make and back up
|
||||
the job-signing key first) → the central server's agent (check `proxy_bind_addr = 127.0.0.1`)
|
||||
→ each church server's agent → **adopt** the demo site, then each church (Link existing → Move
|
||||
onto the monorepo) → a throwaway New install to prove FASTPANEL, DNS and Let's Encrypt.
|
||||
2. **Deploy crosscode-site `v1.3.0`** (secure sign-in in the features and the brochure).
|
||||
3. **Archive `hope-events`** once every install reports 2.2.0 or later (EVENTS-2.2-PLAN §7).
|
||||
4. **Cross Events 2.4.0** (phase 2) is built on branches: run `npm run test:e2e` in `apps/events`
|
||||
(with the e2e Postgres) and the VM test in EVENTS-2.4-PLAN §8, then merge and release in its
|
||||
order (contracts 1.4.0 → Hub 2.2.0, deployed → Events 2.4.0 → crosscode-site 1.4.0).
|
||||
Nothing from phase 1 onwards is rolled out yet (VERSIONS.md, "Deployed / rolled out"), so roll out
|
||||
straight to the latest releases rather than each one in turn.
|
||||
|
||||
1. **VM test the latest releases** before any church gets them (the 2026-11-17 VM test covered
|
||||
Events 2.2 and agent 1.0; Events 2.4+, Accounts and Events 3.x haven't been on it): Events 3.x
|
||||
with Accounts and the move (MIGRATING-TO-3.md), the event feed and Linked products
|
||||
(EVENTS-2.4-PLAN §8), and today's: the Hub's .env panel (read; a backend URL with restart; a
|
||||
frontend value with rebuild; a value that stops the site, so it's put back), the job switches,
|
||||
a demo load (the Accounts link stays) and the people check. Also the Events e2e suite on Postgres.
|
||||
2. **Roll out**, in the order in [ROLLOUT-1.0.md](./ROLLOUT-1.0.md), with the latest releases:
|
||||
**Hub 2.9.0** (make and back up the job-signing key first; 2.4.0 onwards have migrations) → the
|
||||
central server's agent (check `proxy_bind_addr = 127.0.0.1`) → each church server's agent
|
||||
(**1.3.1**, never 1.3.0) → **adopt** the demo site, then each church (Link existing → Move onto the
|
||||
monorepo) → per church **Accounts 1.5.0 before Events 3.6.0**, then the move to Accounts
|
||||
(MIGRATING-TO-3.md) → a throwaway New install to prove FASTPANEL, DNS and Let's Encrypt.
|
||||
3. **Deploy crosscode-site.** `v1.3.0`–`v1.5.0` are tagged but not recorded as deployed;
|
||||
`v1.6.0` (one sign-in through Accounts) once the first church has moved.
|
||||
4. **Archive `hope-events`** once every install reports 2.2.0 or later (EVENTS-2.2-PLAN §7).
|
||||
|
||||
## The VM test (2026-11-17)
|
||||
|
||||
@@ -95,6 +145,19 @@ rollout.
|
||||
- **AI for a church:** set the licence's monthly AI cap above R0 on the Hub; with no cap the
|
||||
buttons don't show (rules in Events' handover, "AI rules"). Churches see tokens; only the Hub
|
||||
shows rand (markup 15% by default).
|
||||
- **The agent's version is in two places:** `apps/agent/package.json` *and* `AGENT_VERSION` in
|
||||
`apps/agent/src/stats.ts` (what it reports to the Hub). Bump both; the agent's test checks they match,
|
||||
so run `npm run check` *after* the bump (1.3.0 shipped reporting 1.2.0).
|
||||
- **Background jobs:** each job's switch and schedule can be set in the site's admin (Events and
|
||||
Accounts, AppSetting `job_overrides`); that wins over the .env flag and `JOB_SCHEDULE_<NAME>`.
|
||||
`JOBS_ENABLED=false` still turns everything off. A new job gets a `label` and, if it may be turned
|
||||
off from the .env, an `env` flag.
|
||||
- **An install's .env from the Hub** (install page → Settings (.env), agent 1.3.0+): plain values
|
||||
only. Names matching `SECRET_ENV_NAME` (contracts) / `SECRET_NAME` (`scripts/lib/envedit.cjs`;
|
||||
keep them in step) and generated values can't be read or changed from the Hub. Changing an
|
||||
address there doesn't change the Hub's domain for the install or FastPanel.
|
||||
- **Demo data keeps the links** to the church's other products (`KEEP_TABLES` in
|
||||
`apps/events/backend/scripts/set-demo.js`). Anything that must survive a demo load goes there.
|
||||
- **Releasing:** branch → merge → tag (`<product>@<version>` here, `v<version>` in events-hub and
|
||||
crosscode-site) → push, with a CHANGELOG entry, and `npm run check` first. Pushes to c-git often
|
||||
fail authentication the first time; retry once. A push can also hang waiting on a login prompt
|
||||
|
||||
+10
-3
@@ -10,13 +10,13 @@ separately below; the two often differ.
|
||||
|
||||
| What | Repo | Latest | Tag | Released |
|
||||
|------|------|--------|-----|----------|
|
||||
| Cross Events | `crosscode-platform` (`apps/events`) | **3.6.0** | `events@3.6.0` | 2026-11-20 |
|
||||
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.5.0** | `accounts@1.5.0` | 2026-11-20 |
|
||||
| Cross Events | `crosscode-platform` (`apps/events`) | **3.6.1** | `events@3.6.1` | 2026-11-20 |
|
||||
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.6.0** | `accounts@1.6.0` | 2026-11-20 |
|
||||
| Server agent | `crosscode-platform` (`apps/agent`) | **1.3.1** | `agent@1.3.1` | 2026-11-20 |
|
||||
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.14.0** | `contracts@1.14.0` | 2026-11-20 |
|
||||
| Cross Code Hub | `events-hub` | **2.9.0** | `v2.9.0` | 2026-11-20 |
|
||||
| crosscode.co.za | `crosscode-site` | **1.6.0** | `v1.6.0` | 2026-11-19 |
|
||||
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-20 (last change: `crosscode env`) |
|
||||
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-20 (last change: nginx `location ^~ /api/`) |
|
||||
|
||||
The `crosscode` script has no version: every server's copy (`/opt/crosscode/tools`) pulls `main`
|
||||
on each run, so merging to `main` and pushing releases it. Its changes are listed in
|
||||
@@ -37,6 +37,13 @@ need their own tags until something outside this repo depends on them.
|
||||
|
||||
## What each latest release was for
|
||||
|
||||
- **Events 3.6.1 (fix):** logo and favicon uploads failed on events-demo: FastPanel's static-file
|
||||
rule sent every `/api/…` path with a file extension to the frontend. The site now passes those on
|
||||
to the backend. Also change the FastPanel site (HANDOVER.md, "FastPanel sites"). No migration.
|
||||
|
||||
- **Accounts 1.6.0:** a "New sign-in" email (and WhatsApp) after every sign-in, as Cross Events'
|
||||
own sign-in sends; admins can turn it off. No migration.
|
||||
|
||||
- **Events 3.6.0 + Accounts 1.5.0 + contracts 1.14.0:** a nightly people check (Events asks Accounts
|
||||
about everyone with an account, 500 at a time, `people.check`): out-of-date copies are fixed,
|
||||
deleted accounts handled as `user.deleted`, and it stops if most people are unknown. Update
|
||||
|
||||
Generated
+4
-4
@@ -46,7 +46,7 @@
|
||||
},
|
||||
"apps/accounts/backend": {
|
||||
"name": "@crosscode/accounts-backend",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
@@ -83,7 +83,7 @@
|
||||
},
|
||||
"apps/accounts/frontend": {
|
||||
"name": "@crosscode/accounts-frontend",
|
||||
"version": "1.5.0",
|
||||
"version": "1.6.0",
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
"@crosscode/ui": "*",
|
||||
@@ -128,7 +128,7 @@
|
||||
},
|
||||
"apps/events/backend": {
|
||||
"name": "@crosscode/events-backend",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@cj-tech-master/excelts": "^10.2.0",
|
||||
@@ -178,7 +178,7 @@
|
||||
},
|
||||
"apps/events/frontend": {
|
||||
"name": "@crosscode/events-frontend",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
"@crosscode/seo": "*",
|
||||
|
||||
+10
-7
@@ -517,15 +517,18 @@ server {
|
||||
server_name $domain;
|
||||
client_max_body_size 25m;
|
||||
|
||||
# For the backend locations below ("location /" sets its own).
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
|
||||
# The API, uploaded files, health and API docs go to the backend; everything else to the site.
|
||||
# (From Events 2.2.0 everything is under /api; the other paths are for older releases.)
|
||||
location ~ ^/(api|uploads|health|docs)(/|\$) {
|
||||
proxy_pass http://127.0.0.1:$api;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
}
|
||||
# ^~ so a regex location added later (e.g. caching *.png) can't send /api/…/logo.png to the site.
|
||||
location ^~ /api/ { proxy_pass http://127.0.0.1:$api; }
|
||||
location ^~ /uploads/ { proxy_pass http://127.0.0.1:$api; }
|
||||
location ~ ^/(api|uploads|health|docs)(/|\$) { proxy_pass http://127.0.0.1:$api; }
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:$web;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
Reference in New Issue
Block a user