---
title: "Language Configuration | Speedscale Docs"
description: "Configure language-specific settings for proxymock to route traffic effectively without modifying application code, ensuring seamless API testing and traffic replay."
canonical: "https://docs.speedscale.com/proxymock/getting-started/language-reference/"
---

[Documentation index](https://docs.speedscale.com/proxymock/llms.txt) | [Markdown](https://docs.speedscale.com/proxymock/getting-started/language-reference/index.md) | [Canonical page](https://docs.speedscale.com/proxymock/getting-started/language-reference/)

# 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:

*   [Java](https://docs.speedscale.com/reference/languages/java#proxymock) — Java demo app
*   [Kotlin](https://docs.speedscale.com/reference/languages/kotlin#proxymock) — Kotlin demo app
*   [.NET](https://docs.speedscale.com/reference/languages/dotnet#proxymock) — .NET demo app
*   [Node.js](https://docs.speedscale.com/reference/languages/nodejs#proxymock) — Node.js demo app
*   [Go](https://docs.speedscale.com/reference/languages/golang#proxymock) — Go demo app
*   [Python](https://docs.speedscale.com/reference/languages/python#proxymock) — Python demo app
*   [Ruby](https://docs.speedscale.com/reference/languages/ruby#proxymock) — Ruby demo app
*   [PHP](https://docs.speedscale.com/reference/languages/php#proxymock) — PHP demo app
*   [Rust](https://docs.speedscale.com/reference/languages/rust#proxymock) — Rust demo app
*   [C++](https://docs.speedscale.com/reference/languages/cpp#proxymock) — C++ demo app

<a id="configuring-the-proxy"></a>

### 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

Proxy support depends on the client library. Some clients ignore environment variables or require explicit proxy settings. Check your client configuration and confirm that a request appears in the recording.

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

<a id="map"></a>

### 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. Many proxy-aware clients accept uppercase and lowercase variants. The [proxymock CLI overview](https://docs.speedscale.com/proxymock/how-it-works/cli/) shows proxy variables, and the [proxymock CLI reference](https://docs.speedscale.com/reference/proxymock-cli-reference/) covers flags and syntax.

`--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:

```shell
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:

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

For more examples, see the [Redis mocking guide](https://docs.speedscale.com/proxymock/databases/record/redis/), [MongoDB guide](https://docs.speedscale.com/proxymock/databases/record/mongodb/), [MySQL guide](https://docs.speedscale.com/proxymock/databases/record/mysql/), [PostgreSQL guide](https://docs.speedscale.com/proxymock/databases/record/postgresql/), [SQL Server guide](https://docs.speedscale.com/proxymock/databases/record/sqlserver/), [Oracle guide](https://docs.speedscale.com/proxymock/databases/record/oracle/), and [Kafka guide](https://docs.speedscale.com/proxymock/message-brokers/record/kafka/).

**Go**

Go respects proxy environment variables.

```shell
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:

```shell
export ALL_PROXY=socks5://localhost:4140
```

**Java**

For a JVM started by proxymock, HTTP/HTTPS proxy and truststore properties are supplied automatically:

```shell
proxymock record -- java -jar app.jar
```

Set `JAVA_HOME` to your JDK so proxymock can create the truststore if needed. For a separate JVM or IDE, configure `http.proxyHost`, `http.proxyPort`, `https.proxyHost`, and `https.proxyPort`, plus the Java truststore. Standard Java networking does not use `HTTP_PROXY` or `SOCKS_PROXY` as a substitute for these properties.

For a SOCKS-capable TCP client, use `-DsocksProxyHost=localhost -DsocksProxyPort=4140`. Driver and transport support varies; use `--map` when the client ignores proxy settings.

See [Java with proxymock](https://docs.speedscale.com/proxymock/guides/java/) for complete HTTP, SOCKS, database, IDE, and CI examples. See [Java TLS trust](https://docs.speedscale.com/reference/java/tls/) for certificate setup.

**Kotlin**

Kotlin/JVM uses the Java networking stack. Standard JVM HTTP clients ignore `HTTP_PROXY` and `HTTPS_PROXY`, so use JVM proxy properties or the SOCKS proxy plus a JKS truststore. See the [Kotlin language page](https://docs.speedscale.com/reference/languages/kotlin/#proxymock) for the complete setup.

**Python**

Python respects proxy environment variables.

```shell
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 (requires `PySocks` package):

```shell
export ALL_PROXY=socks5://localhost:4140
```

**Node.js**

Node.js HTTP libraries handle proxies differently. Environment variables are NOT automatically used by most libraries.

On Node 24 (or 22.21+) the recommended path for **proxymock** is the built-in proxy support — set `NODE_USE_ENV_PROXY=1` so the runtime honors `HTTP_PROXY`/`HTTPS_PROXY`, and `NODE_EXTRA_CA_CERTS` to trust the proxymock certificate:

```shell
export NODE_USE_ENV_PROXY=1
export HTTP_PROXY=http://localhost:4140
export HTTPS_PROXY=http://localhost:4140
export NODE_EXTRA_CA_CERTS=$HOME/.speedscale/certs/tls.crt
```

On older Node versions, configure the proxy at the client level.

For axios (requires explicit configuration or `https-proxy-agent`):

```javascript
const axios = require('axios');

// Option 1: Direct configuration
axios.get('https://example.com', {
  proxy: {
    protocol: 'http',
    host: 'localhost',
    port: 4140
  }
});

// Option 2: Using https-proxy-agent
const HttpsProxyAgent = require('https-proxy-agent');
const agent = new HttpsProxyAgent('http://localhost:4140');

axios.get('https://example.com', {
  httpsAgent: agent
});
```

To respect environment variables with axios:

```shell
export HTTP_PROXY=http://localhost:4140
export HTTPS_PROXY=http://localhost:4140
```

Then use a library like `https-proxy-agent` to read them.

Use the SOCKS proxy to capture database traffic (requires `socks-proxy-agent`):

```javascript
const SocksProxyAgent = require('socks-proxy-agent');
const agent = new SocksProxyAgent('socks5://localhost:4140');
```

**Ruby**

Ruby's `Net::HTTP` honors the `http_proxy`/`https_proxy` environment variables by default, so setting them is usually all that is needed:

```shell
export http_proxy=http://localhost:4140
export https_proxy=http://localhost:4140
export no_proxy=localhost,127.0.0.1
```

If you need to opt in explicitly (for example, when the defaults have been overridden), pass `:ENV` to `Net::HTTP`:

```ruby
require 'net/http'

# This will use environment variables
Net::HTTP.new('example.com', nil, :ENV).start do |http|
  # Uses proxy from env vars if set
end

# Or with URI
uri = URI('https://example.com')
Net::HTTP.start(uri.host, uri.port, :p_addr => :ENV) do |http|
  # Uses proxy from env vars if set
end
```

**PHP**

PHP proxy behavior depends on the client and build. Configure the proxy explicitly when the client does not honor environment variables. See the [PHP language page](https://docs.speedscale.com/reference/languages/php/#proxymock) for a complete record, mock, and replay workflow.

Using cURL:

```php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://example.com");
curl_setopt($ch, CURLOPT_PROXY, "http://localhost:4140");
if ($ca = getenv('SSL_CERT_FILE')) {
    curl_setopt($ch, CURLOPT_CAINFO, $ca);
}
// For SOCKS proxy
// curl_setopt($ch, CURLOPT_PROXY, "socks5://localhost:4140");

// With authentication
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "username:password");

$response = curl_exec($ch);
curl_close($ch);
```

Using stream context:

```php
$context = stream_context_create([
    'http' => [
        'proxy' => 'tcp://localhost:4140',
        'request_fulluri' => true,
    ],
    'ssl' => array_filter([
        'cafile' => getenv('SSL_CERT_FILE'),
    ]),
]);

$response = file_get_contents('https://example.com', false, $context);
```

Set default proxy for all stream operations:

```php
stream_context_set_default([
    'http' => ['proxy' => 'tcp://localhost:4140']
]);
```

**C#/.NET**

.NET Core/5+ respects proxy environment variables:

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

**Rust**

Rust with the `reqwest` crate respects proxy environment variables by default:

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

Certificate handling depends on the selected TLS backend. Add the certificate at `SSL_CERT_FILE` to the client's root certificate store. See the [Rust language page](https://docs.speedscale.com/reference/languages/rust/#proxymock) for a complete record, mock, and replay workflow.

Use the SOCKS proxy to capture database traffic (requires socks feature in Cargo.toml):

```shell
export ALL_PROXY=socks5://localhost:4140
```

Then modify Cargo.toml to:

```toml
reqwest = { version = "your_version_here", features = ["socks"] }
```

<a id="tls-trust"></a>

### 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.

Configure TLS trust in the environment that runs your HTTPS client. Clients that use the Windows certificate store need the [Windows certificate store](https://docs.speedscale.com/proxymock/getting-started/language-reference/#windows-tls-trust) steps below.

**Go**

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

Go reads the `SSL_CERT_FILE` environment variable on Linux to locate trusted root certificates. This environment variable will be automatically populated by the Speedscale operator. Go 1.27 and later also reads it on macOS and Windows. Earlier versions use the keychain on macOS and the [Windows certificate store](https://docs.speedscale.com/proxymock/getting-started/language-reference/#windows-tls-trust) on Windows.

**Node.js**

```shell
export NODE_EXTRA_CA_CERTS="${HOME}/.speedscale/certs/tls.crt"
```

For Node.js applications newer than `v7.3.0`.

**Ruby**

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

Ruby 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.

**.NET**

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

info

.NET uses OpenSSL on Linux, which respects `SSL_CERT_FILE`. The default Microsoft .NET Docker base images are Linux based, so this setting applies. On macOS, .NET uses the system keychain, where proxymock adds its CA by default. On Windows, .NET uses the [Windows certificate store](https://docs.speedscale.com/proxymock/getting-started/language-reference/#windows-tls-trust).

**Java**

Java uses a truststore. The desktop and Kubernetes paths differ:

*   **Desktop or CI:** create `$HOME/.speedscale/certs/cacerts.jks` with `proxymock admin certs --jks`, with `JAVA_HOME` set. A JVM launched directly by `proxymock record -- java ...` receives the truststore properties automatically.
*   **Kubernetes sidecar:** enable `tls-out` and `sidecar.speedscale.com/tls-java-tool-options: "true"`. The operator configures Java to use `/etc/ssl/speedscale/jks/cacerts.jks` inside the container.
*   **Java-agent capture:** keep the application's existing trust configuration. A later replay with mocked TLS dependencies requires trusting the responder CA.

See [Java TLS trust](https://docs.speedscale.com/reference/java/tls/) for complete commands, custom corporate CAs, replay, and troubleshooting. Truststore settings do not route traffic; configure [Java proxy settings](https://docs.speedscale.com/proxymock/guides/java/) when using a forward proxy.

**Kotlin**

Kotlin/JVM applications use the same JKS truststore and JVM properties as Java. See [Kotlin TLS trust](https://docs.speedscale.com/reference/languages/kotlin/#tls-trust) for the Kotlin workflow and [Java TLS trust](https://docs.speedscale.com/reference/java/tls/) for the full truststore reference.

**PHP**

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

PHP cURL does not consistently read `SSL_CERT_FILE`. Pass it to cURL as `CURLOPT_CAINFO`; the [PHP language page](https://docs.speedscale.com/reference/languages/php/#tls-trust) includes the complete example.

**Rust**

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

Rust certificate handling depends on the HTTP client and TLS backend. Add this certificate to the client's root certificate store. The [Rust language page](https://docs.speedscale.com/reference/languages/rust/#tls-trust) describes the rustls and OpenSSL paths.

**C++**

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

C++ 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.

**Python**

```shell
export REQUESTS_CA_BUNDLE="${HOME}/.speedscale/certs/tls.crt"
```

Python applications (including the popular requests library and many others) will use the `REQUESTS_CA_BUNDLE` environment variable to locate trusted root certificates.

<a id="windows-tls-trust"></a>

#### Windows certificate store

Native Windows clients that validate certificates with the Windows certificate store ignore `SSL_CERT_FILE`. These include .NET, SQL Server drivers, Go before 1.27, Rust with `native-tls`, and the `curl.exe` that ships with Windows. Trust the proxymock CA in the Windows certificate store instead. Node.js, Python `requests`, and Java keep their own trust settings, described in the tabs above.

On a Windows desktop, `proxymock init` offers to add the CA to your user's **Trusted Root Certification Authorities** store. Confirm the Windows **Security Warning** dialog and no further setup is needed. Use the steps below if you declined the dialog, passed `--no-cert-install`, set up a headless machine, or need trust for another account or the whole machine.

Apply trust to the runtime that opens the HTTPS connection. If the test calls your app and your app calls the dependency, configure trust for your app's account or Windows environment.

1.  Locate the public CA, `tls.crt`, from the proxymock instance serving the mock. The default Windows path is `%USERPROFILE%\.speedscale\certs\tls.crt`. Run `proxymock admin certs` if you need to generate the CA. Share only the public certificate with your endpoint administrator and keep `tls.key` on the mock host.
    
2.  Choose the trust store approved by your endpoint administrator. For machine-level trust, have them deploy the CA to **Local Computer > Trusted Root Certification Authorities**. For an approved manual install, run the following from elevated PowerShell with the actual path to the public certificate.
    
    ```powershell
    certutil.exe -addstore Root "C:\path\to\tls.crt"
    ```
    
    For per-user trust, run this from regular PowerShell as the user running the HTTPS client. It does not need administrator rights. Windows shows a confirmation dialog, so it fails in headless sessions. For unattended jobs, have your administrator provision trust for the account or environment where the client runs.
    
    ```powershell
    certutil.exe -user -addstore Root "$env:USERPROFILE\.speedscale\certs\tls.crt"
    ```
    
3.  To verify mocking, start proxymock with your recording and disable passthrough. The example assumes proxymock and the client are running on the same Windows host.
    
    ```powershell
    proxymock mock --in .\proxymock\recorded-<timestamp> --out .\proxymock\mock-results --no-passthrough
    ```
    
    Replace `recorded-<timestamp>` with the directory `proxymock record` created. Route the client through proxymock in the session that launches it. For clients that read proxy environment variables, set `HTTPS_PROXY`, using the configured proxy address if you changed the default listener. The language pages cover clients that need other proxy settings, such as [.NET Framework](https://docs.speedscale.com/reference/languages/dotnet/#windows-tls-trust).
    
    ```powershell
    $env:HTTPS_PROXY = "http://127.0.0.1:4140"
    ```
    
    Run a request that exercises the mocked dependency with TLS validation enabled. Confirm the expected response and check the mock output for `match=HIT` and zero passthrough. An unmatched request returns HTTP 404.
    
4.  When the trust is no longer needed, have the certificate owner remove the CA from the trust store by its exact thumbprint. `certutil.exe -dump "C:\path\to\tls.crt"` prints the thumbprint as `Cert Hash(sha1)`. For the machine store, run this from elevated PowerShell:
    
    ```powershell
    certutil.exe -delstore Root <thumbprint>
    ```
    
    For the per-user store, run this from regular PowerShell as that user:
    
    ```powershell
    certutil.exe -user -delstore Root <thumbprint>
    ```
    

See [Microsoft's Windows certificate store guide](https://learn.microsoft.com/en-us/windows-server/identity/ad-cs/inspect-certificates-manage-certificate-stores) and [certutil reference](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/certutil#-addstore).
