Skip to content

Support httpOnly: true option for detection cookie #88

@wheelsandcogs

Description

@wheelsandcogs

🚀 Feature Proposal

Currently the httpOnly flag is set to false here:

and there does not appear to be any way to set it to true.

The proposal is to allow the flag to be set via the detector options in the same way as the cookie domain, path and sameSite options - e.g. cookieHttpOnly: true.

Motivation

This would prevent client-side scripts from accessing or manipulating the language cookie.

Example

detection: {
  order: ['querystring', 'path', 'cookie', 'header'],
  lookupQuerystring: 'lang',
  lookupPath: 'lang',
  lookupCookie: 'lang',
  lookupHeader: 'accept-language',
  caches: ['cookie'],
  cookieDomain: 'example.com',
  cookieSecure: true,
  cookieSameSite: 'strict',
  cookieHttpOnly: true
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions