Skip to main content

Language Configuration

Some language-specific environment configuration may be necessary but you should not need to modify your application code to use proxymock.

If you want the full language-specific first-success path, start here:

  • JavaSpring Boot demo, JVM proxy flags, and the exported production trace.
  • .NETMinimal API demo with HTTP_PROXY/HTTPS_PROXY and local replay.
  • Node.jsExpress demo with client-specific proxy handling guidance.
  • Goouterspace-go demo with Go-native record, mock, and replay steps.
  • PythonFlask SpaceX demo with a lightweight Makefile-backed capture flow.

Configuring the Proxy

As the name implies, proxymock is a proxy which works by routing traffic from your application through proxymock before it goes to the final destination.

warning

99% of the time proxy configuration does not require a code change, but some HTTP client libraries have their own proxy configuration that may override or ignore environment variables. Check the documentation for your specific library.

Record inbound traffic by setting the --app-port flag and making requests to port 4143 instead of your application's port.

When to use --map

Use --map when your client ignores proxy environment variables or when it is easier to point the client at a different host and port than configure proxy support.

Pick your recording mode like this:

  • HTTP, HTTPS, or gRPC clients that honor proxy environment variables: set HTTP_PROXY, HTTPS_PROXY, and grpc_proxy
  • Clients that support SOCKS: set ALL_PROXY
  • Clients that ignore proxy environment variables or use raw TCP protocols such as Redis: use proxymock record --map

Examples on this page follow the casing conventions commonly used by each runtime. The CLI reference uses lowercase shell examples, and many proxy-aware clients accept uppercase and lowercase variants.

--map tells proxymock to listen on a local port and forward traffic to the real backend. Then point your application at the mapped port instead of the real service.

For example, to record Redis traffic, start proxymock with a port mapping and point your app at that mapped port:

proxymock record --out ./proxymock --map 56379=127.0.0.1:6379
export REDIS_ADDR=127.0.0.1:56379
./my-app

If the backend protocol matters, you can also include it explicitly:

proxymock record --map 65432=postgres://localhost:5432
proxymock record --map 1443=https://httpbin.org:443

For more database examples, see the MySQL guide and PostgreSQL guide.

Go respects proxy environment variables.

export HTTP_PROXY=http://localhost:4140
export HTTPS_PROXY=http://localhost:4140
export NO_PROXY=localhost,127.0.0.1

Use the SOCKS proxy to capture database traffic:

export ALL_PROXY=socks5://localhost:4140

Decrypting TLS

proxymock attempts to automatically configure TLS on the desktop so manual configuration is only necessary in special environments like CI/CD or when TLS decryption does not work out of the box.

Commands and flags should be run in the environment where your application is running.

export SSL_CERT_FILE="${HOME}/.speedscale/certs/tls.crt"

Go applications using OpenSSL will respect the SSL_CERT_FILE environment variable to locate trusted root certificates. This environment variable will be automatically populated by the Speedscale operator.