When you need a specific session, bucket, or token on every outgoing request, rewriting the cookie at the proxy is faster than touching the client. setRequestCookieAction keeps the rule contained to the YAML file so reviewers can see exactly what value is being injected and why.
setRequestCookieAction rewrites the outgoing Cookie header so the upstream sees the cookie name and value you specify. The client itself is not modified.
Common use cases:
The action runs on the request side. To set a cookie on the response (as if the server had sent it), use setResponseCookieAction.
Reuse a captured session token so every request to the API behaves as that specific user, without rerunning the login flow each time.
rules:
- filter:
typeKind: HostFilter
pattern: api.internal.example.com
actions:
- typeKind: SetRequestCookieAction
name: JSESSIONID
value: 9C2A4F0E1B7D88A3F6E0
Useful for QA of A/B tested features. The cookie value selects the variant, and the client does not need any code change.
rules:
- filter:
typeKind: HostFilter
pattern: app.example.com
actions:
- typeKind: SetRequestCookieAction
name: experiment_bucket
value: variant_b
Some partner APIs expect a cookie alongside the standard auth header. The action injects it for every request to that host.
rules:
- filter:
typeKind: HostFilter
pattern: api.partner.example.com
actions:
- typeKind: SetRequestCookieAction
name: csrf_token
value: 0a1b2c3d4e5f6a7b8c9d
Add a cookie to request. This action is performed by adding/replacing Cookie header in request.
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
setRequestCookieAction
The following table describes the customizable properties available for this action:
| Property | Type | Description | DefaultValue |
|---|---|---|---|
| name | string | Cookie name | |
| value | string | Cookie value |
The following examples apply this action to any exchanges
Add request cookie with name session and value 123456.
rules:
- filter:
typeKind: AnyFilter
actions:
- typeKind: SetRequestCookieAction
name: session
value: 123456
View definition of SetRequestCookieAction for .NET integration.
The following actions are related to this action:
If a cookie with the same name already exists in the request, its value is replaced. Other cookies on the same header are preserved.
Yes. Add several setRequestCookieAction entries under the same actions list. Each entry handles a single cookie by name.
No. The action runs on the proxy after the client has sent the request. The client is unaware of the rewrite, which is often the whole point.
Encode the value yourself before putting it in the YAML rule. Fluxzy writes the value into the header verbatim.