Add TRUST_PROXY configuration for reverse proxy settings
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m28s
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m28s
This commit is contained in:
@@ -37,6 +37,11 @@ SMTP_FROM=noreply@example.com
|
||||
# App URL (used for verification links, auto-detected if not set)
|
||||
# APP_URL=https://your-domain.com
|
||||
|
||||
# Reverse Proxy trust depth (express 'trust proxy' setting)
|
||||
# loopback = trust only 127.0.0.1 / ::1 (default)
|
||||
# Use a number for proxy hops (e.g. 1), or a specific IP/CIDR.
|
||||
# TRUST_PROXY=loopback
|
||||
|
||||
# Federation (inter-instance meeting invitations)
|
||||
# Set both values to enable federation between Redlight instances
|
||||
# FEDERATION_DOMAIN=redlight.example.com
|
||||
|
||||
@@ -18,8 +18,11 @@ const __dirname = path.dirname(__filename);
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3001;
|
||||
|
||||
// Trust proxy for correct req.protocol behind reverse proxy
|
||||
app.set('trust proxy', true);
|
||||
// Trust proxy – configurable via TRUST_PROXY env var (default: 1 = one local reverse proxy)
|
||||
// Use a number to trust that many hops, or a string like 'loopback' / an IP/CIDR.
|
||||
const rawTrustProxy = process.env.TRUST_PROXY ?? 'loopback';
|
||||
const trustProxy = /^\d+$/.test(rawTrustProxy) ? parseInt(rawTrustProxy, 10) : rawTrustProxy;
|
||||
app.set('trust proxy', trustProxy);
|
||||
|
||||
// Middleware
|
||||
app.use(cors());
|
||||
|
||||
Reference in New Issue
Block a user