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

htmlResponseFilter Filter

Match responses whose Content-Type indicates HTML, so you can inject scripts, rewrite markup, or focus your debug pipeline on pages.

Working with HTML responses is a recurring need in web debugging: you might want to inject a probe script, force a no cache policy, or simply tag pages so they stand out from the asset noise. The htmlResponseFilter is the fastest way to scope a rule to that subset, relying on the Content-Type header so it runs as soon as the response is identified.

When to use this filter

Use htmlResponseFilter when a rule should only run on responses returning HTML. The filter inspects the Content-Type header for a text/html hint, so it triggers as soon as the response headers arrive, before the body is fully streamed.

Typical uses:

  • Injecting a debug script or noindex tag into every HTML page served through Fluxzy.
  • Stripping caching headers from HTML responses while preserving them for assets.
  • Capturing or tagging only page responses to focus a triage session.

Real world examples

Inject a debug script into every HTML page

Add a script tag right before on every HTML response so you can profile pages without rebuilding the app.

rules:
- filter:
    typeKind: HtmlResponseFilter
  actions:
  - typeKind: InjectHtmlTagAction
    tag: '<script src="https://debug.example.com/probe.js"></script>'
    location: BeforeHeadEnd

Remove caching headers from HTML responses

Force the browser to refetch HTML on every load while leaving CSS and images cached normally.

rules:
- filter:
    typeKind: HtmlResponseFilter
  actions:
  - typeKind: RemoveCacheAction

Tag HTML responses from a specific host

Single out HTML pages from one origin so you can quickly find them in a busy capture.

rules:
- filter:
    typeKind: FilterCollection
    operation: And
    children:
    - typeKind: HtmlResponseFilter
    - typeKind: HostFilter
      pattern: www.example.com
      operation: Exact
  actions:
  - typeKind: ApplyTagAction
    tag:
      value: html-page

Reference

htmlResponseFilter

Description

Select exchanges having HTML body. The content-type header is checked to determine if the content body is has text/html hint.

Evaluation scope

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

responseHeaderReceivedFromRemote This scope occurs the moment fluxzy has done parsing the response header.

YAML configuration name

htmlResponseFilter

Settings

This filter has no specific characteristic

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

Property Type Description DefaultValue
inverted boolean Negate the filter result false

Example of usage

The following examples apply a comment to the filtered exchange

Select exchanges having HTML body. The content-type header is checked to determine if the content body is has text/html hint.

rules:
- filter:
    typeKind: HtmlResponseFilter
  actions:
  - typeKind: ApplyCommentAction
    comment: filter was applied

.NET reference

View definition of HtmlResponseFilter for .NET integration.

See also

The following filters are related to this filter:

Frequently asked questions

Does it sniff the body or only read the header?

Only the Content-Type header is inspected. If a server lies about the content type, the filter will trust the header. Pair it with body inspection if you need real sniffing.

Will it match XHTML or text/xml documents?

No. It triggers only on text/html. Use contentTypeXmlFilter for XML responses and pair filters together if you want both.

Can I combine it with status code filters to ignore redirects?

Yes. Wrap it inside a FilterCollection along with statusCodeSuccessFilter to act only on successful HTML responses.

Learn more about Fluxzy rules