Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
At a glance
Goal: Control whether Dev Proxy captures all system traffic or only explicitly routed traffic
Time: 5 minutes
Prerequisites: Set up Dev Proxy
By default, when you start Dev Proxy, it registers itself as the system proxy. As a result, all HTTP/HTTPS traffic on your machine is automatically routed through Dev Proxy. Proxying all traffic through Dev Proxy works well for most scenarios—you start Dev Proxy, and it immediately captures requests from your application without any extra configuration.
However, there are situations where you might want more control over which traffic goes through Dev Proxy. The asSystemProxy option lets you disable automatic system proxy registration, giving you fine-grained control over which applications use Dev Proxy.
When to disable system proxy registration
Consider setting asSystemProxy to false when:
- You're on a corporate network with existing proxy settings that you don't want to override
- You only want to test a specific application without affecting other apps running on your machine
- Other applications fail when Dev Proxy intercepts their traffic (for example, Azure Functions)
- You're running multiple Dev Proxy instances and want to route traffic to specific instances
- You want to minimize interference with system services and background processes
Configure the system proxy option
You can configure the asSystemProxy option in two ways: using the configuration file or command line.
Configuration file
To persistently disable system proxy registration, add the asSystemProxy setting to your configuration file.
File: devproxyrc.json
Purpose: Disable automatic system proxy registration
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.2.0/rc.schema.json",
"asSystemProxy": false,
"urlsToWatch": [
"https://api.contoso.com/*"
]
}
Command line
To disable system proxy registration for a single session, use the --as-system-proxy option.
devproxy --as-system-proxy false
Route traffic to Dev Proxy manually
When you disable system proxy registration, applications don't automatically route their traffic through Dev Proxy. You need to configure each application to use Dev Proxy explicitly.
Using environment variables
The most common way to route traffic to Dev Proxy is by setting the HTTPS_PROXY environment variable.
PowerShell:
$env:HTTPS_PROXY = "http://127.0.0.1:8000"
node app.js
Command Prompt:
set HTTPS_PROXY=http://127.0.0.1:8000
node app.js
HTTPS_PROXY=http://127.0.0.1:8000 node app.js
Tip
Some applications also support the HTTP_PROXY environment variable. Set both if your application makes both HTTP and HTTPS requests.
Language-specific configuration
Different programming languages and frameworks have their own ways of configuring proxies:
- Node.js: Use the global-agent package or configure the HTTP agent directly
- .NET: Set the
HTTPS_PROXYenvironment variable or configureHttpClientwith a proxy (see Use Dev Proxy with .NET applications) - Azure Functions: Configure proxy in
local.settings.json(see Use Dev Proxy with .NET Azure Functions)
Example: Test Azure Functions without interfering with startup
Azure Functions uses gRPC for internal communication, which fails when Dev Proxy is registered as the system proxy. To use Dev Proxy with Azure Functions, disable system proxy registration and configure the proxy through environment variables.
File: devproxyrc.json
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v2.2.0/rc.schema.json",
"asSystemProxy": false,
"urlsToWatch": [
"https://jsonplaceholder.typicode.com/*"
]
}
File: local.settings.json
{
"IsEncrypted": false,
"Values": {
"HTTPS_PROXY": "http://127.0.0.1:8000"
}
}
With this configuration, Azure Functions starts normally while your HTTP requests to the watched URLs are routed through Dev Proxy.
Example: Test one application while keeping others unaffected
When you're developing multiple applications simultaneously, you might want to use Dev Proxy with only one of them. Disable system proxy registration and set the environment variable only for the target application.
Start Dev Proxy without system proxy registration:
devproxy --as-system-proxy false
In a separate terminal, run your application with the proxy configured:
$env:HTTPS_PROXY = "http://127.0.0.1:8000"
npm start
HTTPS_PROXY=http://127.0.0.1:8000 npm start
Other applications on your machine continue to work normally without any proxy interference.