New Fluxzy v2 just shipped. Electron is out, Tauri is in. gRPC ready, 3x smaller install. Learn more

clearSessionAction Action

Wipe stored session data from previous applySessionAction or captureSessionAction calls so the next request starts from a clean slate.

Session state is one of the most common sources of flaky integration tests. When Fluxzy replays cookies for you through applySessionAction, you also need a clean way to drop that state at the right moment. clearSessionAction is the small but essential primitive that makes session aware rules safe to reuse across runs.

When to use this action

Use clearSessionAction when you want the next request to start without any session state that an earlier captureSessionAction or applySessionAction left behind. It is the easiest way to guarantee that two test runs do not contaminate each other.

Typical situations include:

  • Logging out before a load test so each iteration goes through the real authentication flow.
  • Wiping cookies for a specific domain before exercising an anonymous code path.
  • Resetting state between QA scenarios that share the same Fluxzy instance.

The action runs on the requestHeaderReceivedFromClient scope. Without a domain value it clears every captured session for every host. Set domain when you only want to forget one upstream.

Real world examples

Drop all stored sessions before a fresh login flow

Useful in a test rig that wants to make sure no cookie or token from a previous run leaks into the current request.

rules:
- filter:
    typeKind: PathFilter
    pattern: /login
  actions:
  - typeKind: ClearSessionAction

Clear the session for one upstream only

Keep cached sessions for other domains while resetting the one you are actively testing.

rules:
- filter:
    typeKind: HostFilter
    pattern: api.internal.example.com
  actions:
  - typeKind: ClearSessionAction
    domain: api.internal.example.com

Reset session state on a specific request method

Some flows reuse the same path with different methods. Tying the clear to a POST keeps the GET hot path untouched.

rules:
- filter:
    typeKind: FilterCollection
    operation: And
    children:
    - typeKind: HostFilter
      pattern: payments.example.com
    - typeKind: MethodFilter
      methods:
      - POST
  actions:
  - typeKind: ClearSessionAction
    domain: payments.example.com

Reference

clearSessionAction

Description

Clear stored session data for a specific domain or all domains.

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

clearSessionAction

Settings

This action has no specific characteristic

Example of usage

The following examples apply this action to any exchanges

Clear all stored sessions.

rules:
- filter:
    typeKind: AnyFilter
  actions:
  - typeKind: ClearSessionAction

Clear session for a specific domain.

rules:
- filter:
    typeKind: AnyFilter
  actions:
  - typeKind: ClearSessionAction
    domain: example.com

.NET reference

View definition of ClearSessionAction for .NET integration.

See also

The following actions are related to this action:

Frequently asked questions

Does clearSessionAction delete cookies in the original client?

No. It only clears the session state Fluxzy stores in memory. The client browser or HTTP library keeps its own cookie jar untouched.

What is the difference between clearSessionAction and removeResponseCookieAction?

clearSessionAction wipes the session data Fluxzy itself replays through applySessionAction. removeResponseCookieAction edits a Set-Cookie header on the wire so the client never stores the cookie.

Can I clear several domains at once?

Yes. Either omit the domain property to clear everything, or chain multiple ClearSessionAction entries inside the same rule, each with its own domain.

When does the action take effect?

As soon as the request header is parsed, before any session replay runs. That means a clear on the same exchange as an applySessionAction will leave the request without cookies.

Learn more about Fluxzy rules