Put zapier.georgelambert.org service names on Caddy.
Some checks are pending
offline / test (push) Waiting to run

HTTPS reverse-proxy for portal, api, leaf, zap, staff, iam, login,
cs, sales, acct, mw, and fleet. Staff HTML login redirects use
X-Forwarded-Proto so next= is https on the public host.
This commit is contained in:
George Lambert 2026-09-11 20:04:57 -04:00
parent bd94d6c208
commit acf902e361
10 changed files with 118 additions and 11 deletions

View file

@ -26,7 +26,9 @@ export async function denyOrRedirect(req, res, json, { permission, html }) {
if (out.ok) return out;
const login = iamBase() || (process.env.STAFF_SESSION_URL || 'http://127.0.0.1:3028').replace(/\/$/, '');
if (html) {
res.writeHead(302, { location: `${login}/login?next=${encodeURIComponent('http://' + (req.headers.host || '127.0.0.1') + '/')}` });
const proto = String(req.headers['x-forwarded-proto'] || 'http').split(',')[0].trim();
const host = String(req.headers['x-forwarded-host'] || req.headers.host || '127.0.0.1').split(',')[0].trim();
res.writeHead(302, { location: `${login}/login?next=${encodeURIComponent(`${proto}://${host}/`)}` });
res.end();
return false;
}