express-tailscale-auth
Version:
Express middleware for Tailscale authentication
15 lines (10 loc) • 808 B
JavaScript
'use strict';var s=e=>{let r=e.app.get("trust proxy");return !!(e.headers["x-forwarded-for"]||e.headers["x-forwarded-host"]||e.headers["x-forwarded-proto"])&&(r===false||r===void 0)?(console.warn(`
\u26A0\uFE0F Tailscale Auth Middleware Warning \u26A0\uFE0F
Detected X-Forwarded-* headers but Express 'trust proxy' is not configured.
This may result in incorrect IP address detection and authentication failures.
To fix this, add one of the following to your Express app:
// For most reverse proxy setups (recommended)
app.set('trust proxy', ['loopback', 'linklocal', 'uniquelocal'])
See: https://expressjs.com/en/guide/behind-proxies.html
`),true):false};exports.checkTrustProxyConfiguration=s;//# sourceMappingURL=checkTrustProxyConfig.cjs.map
//# sourceMappingURL=checkTrustProxyConfig.cjs.map