@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 691 B
JavaScript
const e=e=>{if(!e)return!1;let t=e.split(`,`);for(let e of t){let t=e.split(`;`);for(let e of t){let[t,n]=e.split(`=`);if(!(!t||!n)&&t.trim().toLowerCase()===`proto`)return n.trim().replace(/^["']|["']$/g,``).toLowerCase()===`https`}}return!1},t=t=>{if(t.req.url.startsWith(`https://`))return!0;if(!t.get(`config`).http.security.trustProxyHeaders)return!1;if(e(t.req.header(`Forwarded`)))return!0;let n=t.req.header(`X-Forwarded-Proto`);return!!(n&&n.split(`,`)[0]?.trim().toLowerCase()===`https`||t.req.header(`X-Forwarded-Ssl`)?.trim().toLowerCase()===`on`||t.req.header(`Front-End-Https`)?.trim().toLowerCase()===`on`)};export{t as default};
//# sourceMappingURL=is-request-secure.mjs.map