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

updateRequestHeaderAction Action

Replace, append to, or conditionally add a request header before Fluxzy forwards the exchange to the upstream server.

Request headers are the easiest surface to manipulate when reproducing API behavior. Overwriting a value, prefixing it with {{previous}}, or seeding it when missing covers most rewrite needs without duplicating headers or breaking the connection layer.

When to use this action

Use updateRequestHeaderAction whenever you need to change the value of an outgoing request header without inserting a duplicate copy. The action overwrites the existing value, or adds the header if addIfMissing is true. Unlike addRequestHeaderAction, which always appends, this action guarantees a single header instance after the rewrite.

Two patterns make this action especially useful:

  • Use the {{previous}} placeholder to reference the original value, which lets you prepend or append data instead of replacing it.
  • Combine addIfMissing: true with appendSeparator to ensure a header exists, while still appending cleanly when it already does.

Headers that affect the connection itself (Host, Connection, Transfer-Encoding, Content-Length, and similar) are ignored to preserve protocol integrity.

Real world examples

Overwrite the User-Agent header with a custom value

Replace whatever the client sent with a fixed identifier, useful for QA fingerprinting.

rules:
- filter:
    typeKind: AnyFilter
  actions:
  - typeKind: UpdateRequestHeaderAction
    headerName: User-Agent
    headerValue: FluxzyQA/1.0

Append a marker to the existing Accept header

Use {{previous}} to keep the original value and add a custom suffix that downstream services can detect.

rules:
- filter:
    typeKind: AnyFilter
  actions:
  - typeKind: UpdateRequestHeaderAction
    headerName: Accept
    headerValue: "{{previous}}, application/x-fluxzy-debug"
    addIfMissing: true
    appendSeparator: ", "

Insert an X-Forwarded-For value when missing

Set the header to a known client IP only if upstream proxies have not already added one.

rules:
- filter:
    typeKind: HostFilter
    pattern: api.example.com
  actions:
  - typeKind: UpdateRequestHeaderAction
    headerName: X-Forwarded-For
    headerValue: "{{previous}}, 203.0.113.10"
    addIfMissing: true
    appendSeparator: ", "

Reference

updateRequestHeaderAction

Description

Update and existing request header. If the header does not exists in the original request, the header will be added.
Use {{previous}} keyword to refer to the original value of the header.
Note Headers that alter the connection behaviour will be ignored.

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

updateRequestHeaderAction

Settings

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

Property Type Description DefaultValue
headerName string
headerValue string
addIfMissing boolean false
appendSeparator string Only active when AddIfMissing=true When updating an existing header, this value will be used to separate the original value and the new value.

Example of usage

The following examples apply this action to any exchanges

Update the User-Agent header.

rules:
- filter:
    typeKind: AnyFilter
  actions:
  - typeKind: UpdateRequestHeaderAction
    headerName: User-Agent
    headerValue: Fluxzy

.NET reference

View definition of UpdateRequestHeaderAction for .NET integration.

See also

The following actions are related to this action:

Frequently asked questions

What does the `{{previous}}` placeholder reference?

It expands to the original value of the same header in the incoming request. If the header did not exist, it expands to an empty string.

How is this different from addRequestHeaderAction?

addRequestHeaderAction always appends a new header instance. updateRequestHeaderAction replaces the existing value, or adds the header once when addIfMissing is true. The result is a single header line.

Why does my Host header change appear to be ignored?

Connection critical headers such as Host, Content-Length, Transfer-Encoding, and Connection are filtered out to keep the protocol valid. Adjust those values with dedicated actions or by spoofing the destination.

Can I update multiple headers at once?

Yes. Chain several updateRequestHeaderAction entries under the same filter, one per header. Fluxzy applies them in order.

Learn more about Fluxzy rules