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

spoofDnsAction Action

Override DNS or system host resolution for selected hostnames so traffic reaches a specific IP or port of your choice.

DNS overrides are a quiet but powerful interception technique. They let you reroute traffic at the network layer without touching the client, the resolver, or the hosts file, which is invaluable when chasing down environment specific bugs.

When to use this action

Use spoofDnsAction to force Fluxzy to dial a specific IP and port for matching exchanges, regardless of what the operating system resolver returns. This is the equivalent of editing /etc/hosts but scoped to a single proxy session and selectable per host or path. Common scenarios:

  • Redirect production hostnames to a staging server while testing a release candidate.
  • Send requests for a third party API to a local mock running on 127.0.0.1.
  • Reproduce DNS poisoning or geo routing problems by pinning a service to a different region's IP.
  • Bypass a misbehaving local resolver during incident debugging.

You can override only the IP, only the port, or both. The host name presented to the server (and used for SNI) stays the one the client originally asked for, which keeps TLS validation working as long as the certificate is valid for that name.

Real world examples

Redirect a production hostname to localhost for testing

Send every request for api.example.com to a local mock listening on port 8080 without touching the client configuration.

rules:
- filter:
    typeKind: HostFilter
    pattern: api.example.com
  actions:
  - typeKind: SpoofDnsAction
    remoteHostIp: 127.0.0.1
    remoteHostPort: 8080

Pin a hostname to a staging IP without changing the port

Keep the original port the client requested, only override the IP so traffic reaches the staging machine.

rules:
- filter:
    typeKind: HostFilter
    pattern: cdn.example.com
  actions:
  - typeKind: SpoofDnsAction
    remoteHostIp: 10.0.0.42

Force a single port redirect to a debug listener

Used together with skipSslTunnelingAction when the local listener does not speak TLS.

rules:
- filter:
    typeKind: HostFilter
    pattern: events.example.com
  actions:
  - typeKind: SpoofDnsAction
    remoteHostIp: 127.0.0.1
    remoteHostPort: 9000
  - typeKind: SkipSslTunnelingAction

Reference

spoofDnsAction

Description

Fix statically the remote ip or port disregards to the dns or host resolution of the current running system. Use this action to force the resolution of a hostname to a fixed IP address.

Evaluation scope

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

onAuthorityReceived This scope denotes the moment fluxzy is aware the destination authority. In a regular proxy connection, it will occur the moment where fluxzy parsed the CONNECT request.

YAML configuration name

spoofDnsAction

Settings

This action has no specific characteristic

Example of usage

The following examples apply this action to any exchanges

Force the remote IP and port to be respectively 127.0.0.1 and 8080.

rules:
- filter:
    typeKind: AnyFilter
  actions:
  - typeKind: SpoofDnsAction
    remoteHostIp: 127.0.0.1
    remoteHostPort: 8080

Force the remote IP to be 127.0.0.1 (port remains the same as request by the client).

rules:
- filter:
    typeKind: AnyFilter
  actions:
  - typeKind: SpoofDnsAction
    remoteHostIp: 127.0.0.1

Force the remote port to be 8080 (IP remains the same as request by the client).

rules:
- filter:
    typeKind: AnyFilter
  actions:
  - typeKind: SpoofDnsAction
    remoteHostIp: 127.0.0.1

.NET reference

View definition of SpoofDnsAction for .NET integration.

See also

The following actions are related to this action:

Frequently asked questions

Does the action change the Host header or the SNI extension?

No. The hostname presented to the server stays untouched. Only the destination IP and port used for the TCP connection are overridden.

What if the destination server uses a different certificate?

TLS validation runs against the original hostname. If the IP you target serves a certificate that does not match that name, the handshake fails unless you also enable skipRemoteCertificateValidationAction.

Can I spoof DNS for HTTP traffic only?

Yes. Combine the action with a scheme aware filter such as isSecureFilter to restrict the override to HTTP or HTTPS exchanges.

Is this faster than editing /etc/hosts?

It is more flexible. You can scope by host pattern, port, process name, or any other filter, and the override only lasts as long as Fluxzy is running with the rule loaded.

Learn more about Fluxzy rules