INNER CODE UNIT · TypeScript

forwardedProtoIsHttps

namecheap/ilc · ilc/server/experiments/index.ts:22

function forwardedProtoIsHttps(request: PatchedFastifyRequest): boolean {
    const header = request.raw.headers['x-forwarded-proto'];
    const value = Array.isArray(header) ? header[0] : header;
    return typeof value === 'string' && value.split(',')[0].trim().toLowerCase() === 'https';
}

/**
 * True when any active experiment can split visitors into personalized and baseline
 * populations on the SAME URL — an `enrollment` gate (unenrolled visitors get baseline)
 * or a `consentCategory` (denied/unknown visitors get baseline). While such an
 * experiment is live, even a fully inert baseline response must be uncacheable:
 * a shared cache/CDN would otherwise store the baseline under the bare URL and serve it
 * to an *enrolled* visitor, whose request then never reaches the origin — masking their
 * stored assignment and breaking the "enrolled on every route" guarantee. Ungated,
 * unconditioned experiments personalize every response, so they are already `no-store`
 * per response and don't need this; an empty ruleset stays fully inert (cacheable).
 */
function rulesetSplitsPopulation(ruleset: Ruleset): boolean {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…