Skip to content

perf: limit cookie parse only on some cookie #126

@cesco69

Description

@cesco69

Hi, in my express I use only 1 cookie (API_TOKEN), but client side send varius cookie eg:

_ga_M9MSXKVJN9=XXXX; 
_ga_W98228BE06=XXXX; 
_gid=XXXX; _ga=XXXX; 
_gcl_au=XXXX; 
_ga_5MFMLYZHT2=XXXX; 
rxVisitor=XXXX; 
_ga_K4Y50QD36K=XXXX; 
dtCookie=XXXX; 
dtSa=XXXX; 
rxvt=XXXX; 
API_TOKEN=XXXX;

the _g* cookies are Google Analitycs / Google Tag Manage
the _dt* and rx* cookies are Dynatrace
the API_TOKEN is the only one used by my express!

Parsig all those cookies on each request has a performance impact!

The idea is introduce an option for limit the cookie parsing on a limit numer of cookies, eg.:

app.use(cookieParser({null, {
   allowedCookie: ['API_TOKEN']
}}))

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