New Transparent capture is in preview. Record every app's traffic with no proxy configuration, on Windows, macOS and Linux. Learn more

hasCookieOnRequestFilter Filter

Match requests that send a specific cookie by name, with an optional value pattern, so you can target sessions, tracking IDs, or feature flags.

Cookies are the easiest way to identify sessions, feature flags, and tracking state in real traffic, and the hasCookieOnRequestFilter lets you select exchanges by cookie name with the same level of control you get from a regex search. Combine it with rewrite or tagging actions to keep noisy state under control during a debug session.

When to use this filter

Reach for hasCookieOnRequestFilter when a rule should only fire on requests that send a particular cookie. You can match by name only, or narrow further with a value pattern, supporting exact, contains, startsWith, endsWith, and regex operations.

Practical uses:

  • Targeting traffic that carries a session cookie like JSESSIONID or PHPSESSID.
  • Detecting requests that include a specific feature flag or A/B cohort cookie.
  • Stripping a tracking cookie while leaving the rest of the cookies untouched.

Real world examples

Tag traffic that carries a session cookie

Mark every exchange that sends a JSESSIONID cookie so you can filter or export them later.

rules:
- filter:
    typeKind: HasCookieOnRequestFilter
    name: JSESSIONID
    pattern: ''
    operation: Regex
  actions:
  - typeKind: ApplyTagAction
    tag:
      value: java-session

Match a feature flag cookie with a value pattern

Trigger only when the cookie value indicates the user is in a specific cohort.

rules:
- filter:
    typeKind: HasCookieOnRequestFilter
    name: ab_cohort
    pattern: experiment-b
    operation: Exact
    caseSensitive: true
  actions:
  - typeKind: AddRequestHeaderAction
    headerName: x-cohort-debug
    headerValue: experiment-b

Remove a tracking cookie before it leaves the proxy

Rewrite the cookies so the chosen tracking ID never reaches the upstream server.

rules:
- filter:
    typeKind: HasCookieOnRequestFilter
    name: _ga
    pattern: ''
    operation: Regex
  actions:
  - typeKind: SetRequestCookieAction
    name: _ga
    value: ''

Reference

hasCookieOnRequestFilter

Description

Exchange having a request cookie with a specific name

Evaluation scope

Evaluation scope defines the timing where this filter will be applied.

requestHeaderReceivedFromClient This scope occurs the moment fluxzy parsed the request header receiveid from client

YAML configuration name

hasCookieOnRequestFilter

Settings

The following table describes the customizable properties available for this filter:

Property Type Description DefaultValue
name string Cookie name
pattern string The string pattern to search
operation exact | contains | startsWith | endsWith | regex The search operation performed contains
caseSensitive boolean true if the Search should be case sensitive false
inverted boolean Negate the filter result false

Example of usage

The following examples apply a comment to the filtered exchange

Select only filter having a request cookie with name JSESSIONID.

rules:
- filter:
    typeKind: HasCookieOnRequestFilter
    name: JSESSIONID
    pattern: ''
    operation: Regex
  actions:
  - typeKind: ApplyCommentAction
    comment: filter was applied

.NET reference

View definition of HasCookieOnRequestFilter for .NET integration.

See also

The following filters are related to this filter:

Frequently asked questions

What does the pattern field mean when I only care about the cookie name?

Leave pattern empty and set operation: Regex. An empty regex matches any value, so the filter triggers whenever the named cookie is present.

Is the cookie name case sensitive?

Cookie names follow HTTP semantics. The filter compares them case sensitively against the request, so spell the name exactly as the client sends it.

Can I match several cookies at once?

Stack multiple hasCookieOnRequestFilter blocks inside a FilterCollection with an And or Or operation to combine cookie checks.

Learn more about Fluxzy rules