The Problem: When ’no_proxy’ is Ignored

In a modern corporate environment, working behind a proxy is often a necessity. To access internal resources while still allowing VS Code to download updates, plugins, and connect to LLM providers, I rely heavily on environment variables like https_proxy and no_proxy.

However, I ran into a frustrating roadblock: A specific VS Code plugin I needed for my daily work consistently ignored the no_proxy variable but strictly enforced https_proxy. This caused internal connections to fail because the plugin tried to route them through the corporate proxy, which couldn’t see our internal network.

Since I couldn’t fix the plugin’s source code(proprietary Rust) directly, I needed a way to “lie” to the plugin about its environment—surgically removing or overriding variables only for that specific process.

The Solution: Redir

Redir is a lightweight, high-performance environment filter wrapper written in C++20. It acts as a transparent proxy for any executable, allowing you to modify the environment (Add/Update/Remove) before the target application even starts.

How it works

  1. Rename your target executable (e.g., tool.exe to tool_org.exe).
  2. Replace the original file with the redir binary (renamed to tool.exe).
  3. Create a tool_conf.env configuration file to define your environment rules.

Detailed Application & Configuration

The beauty of Redir lies in its surgical precision. You define exactly what should happen in your *_conf.env file.

Configuration Example (tool_conf.env)

# Remove problematic proxy settings for this tool
- https_proxy
- http_proxy

# Or force specific settings
+ https_proxy = http://internal-proxy.corp:8080
+ no_proxy = .internal.company.com,localhost

Activation & Debugging

To keep the tool lightweight and prevent accidental interception, Redir only activates when a specific flag is set. For troubleshooting, you can also dump the resulting environment to a file.

Variable Value Description
REDIR_ENABLE_REDIR 1 Required. Activates the environment filtering.
REDIR_DUMP_ENV 1 Debug. Dumps the final environment to [exe]_pid_env.txt.

Platform-Specific Examples

Windows (PowerShell)

If you want to wrap a tool like vscode-helper.exe:

  1. Rename vscode-helper.exe -> vscode-helper_org.exe.
  2. Copy redir.exe to vscode-helper.exe.
  3. Set the activation flag and run your tool:
# Activate Redir and enable debugging
$env:REDIR_ENABLE_REDIR = "1"
$env:REDIR_DUMP_ENV = "1"

# Launch your wrapped tool
.\vscode-helper.exe --some-args

# Check the results in the dump file:
Get-Content "vscode-helper_*_env.txt"

Linux (Bash)

On Linux, the setup is just as simple. Let’s assume a tool called cli-worker:

  1. Rename cli-worker -> cli-worker_org.
  2. Copy redir to cli-worker.
  3. Run it with the required flags:
# Run with environment variables set inline
REDIR_ENABLE_REDIR=1 REDIR_DUMP_ENV=1 ./cli-worker --some-args

# Verify the environment was applied:
cat cli-worker_*_env.txt

Why Use Redir?

  • Surgical Precision: Only modify the variables you want.
  • Transparent Execution: Full pass-through for arguments, stdin, stdout, and exit codes.
  • Zero Overhead: Native C++ with no external dependencies.
  • No Global Changes: Fix the environment for one specific tool without breaking the rest of your system.

Get the Source

Redir is open-source and available on GitHub. Whether you are fighting corporate proxies or just need to sandbox your environment variables, feel free to check it out!

👉 redir