Skip to content

DevProxy not intercepting localhost requests when api is launched from Visual Studio 2022 #1403

Description

It's not clear to me how to get devProxy to intercept localhost requests when debug session launched from Visual Studio 2022 Pro. Requests made to https://jsonplaceholder.typicode.com are intercepted fine.

I have an asp net core web api that will launch on localhost:60309, and a sample ping endpoint

GET https://localhost:60309/ss/ping

I launch devproxy with a config file, which includes the port, an ExecutionSummaryPlugin and a reporter (all fine for jsonplaceholder.typicode.com)

"urlsToWatch": [
     "https://jsonplaceholder.typicode.com/*",
     "https://localhost:60309/*"
  ],

I've updated VS through the "Browse with..." dialog to Add a new browser,
FriendlyName: "EdgeProxy"
Program: "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
Arguments: --proxy-bypass-list="<-loopback> --proxy-server="127.0.0.1:8000"`

I make sure no instance of edge is running. Click the Debug option in VS, choosing "EdgeProxy", which launches msedge with the API running - but devProxy never intercepts any requests to GET https://localhost:60309/ss/ping (made via a VSCode .http and from Postman)

Where am I going wrong?
I have tried variants of using the build in server. IISExpress, Debug, "Start without Debugging" - no variant has the proxy.

I have also tried just starting edge using Run: msedge --proxy-bypass-list="<-loopback> --proxy-server="127.0.0.1:8000
The choosing Edge as the browser in VS, which launches the app in a new tab of the browser launched from Run. Doesn't intercept.

Windows 11, all up to date. Any suggestions welcome.
A walkthrough would be amazing, if anyone else has got this to work.

Activity

  1. waldekmastykarz commented on Oct 1, 2025

    @waldekmastykarz
    Collaborator

    Thanks for reaching out and sorry to hear you're getting stuck. Could it be that Windows' proxy settings override Edge's proxy bypass list? If I recall correctly, you can also configure proxy bypass list in Windows' Internet settings.

  2. neil-thompson-schemeserve commented on Oct 1, 2025

    @neil-thompson-schemeserve
    Author

    In Control Panel > Network and Internet > Internet Options
    Connections tab > LAN Settings > Proxy Server> Advanced > Exceptions

    I added localhost:60309, but this hasn't helped.
    Also tried ticking "Bypass proxy server for local addresses" - no joy

    Thanks though :)

  3. waldekmastykarz commented on Oct 1, 2025

    @waldekmastykarz
    Collaborator

    Thanks for confirming. We'll check it out and get back to you asap.

  4. waldekmastykarz commented on Oct 2, 2025

    @waldekmastykarz
    Collaborator

    I've followed your steps and it seems to be working just fine for me:

    Image

    Here is my devproxyrc.json:

    {
      "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.2.0/rc.schema.json",
      "plugins": [
        {
          "name": "GenericRandomErrorPlugin",
          "enabled": true,
          "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
          "configSection": "weatherApiErrors"
        }
      ],
      "urlsToWatch": [
        "https://localhost:7232/*"
      ],
      "weatherApiErrors": {
        "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.2.0/genericrandomerrorplugin.schema.json",
        "errorsFile": "weather-api-errors.json"
      }
    }

    And the weather-api-errors.json:

    {
      "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.2.0/genericrandomerrorplugin.errorsfile.schema.json",
      "errors": [
        {
          "request": {
            "url": "https://localhost:7232/WeatherForecast*"
          },
          "responses": [
            {
              "statusCode": 500,
              "headers": [
                {
                  "name": "content-type",
                  "value": "application/json; charset=utf-8"
                }
              ],
              "body": {
                "type": "https://tools.ietf.org/html/rfc7231#section-6.6.1",
                "title": "An error occurred while processing your request.",
                "status": 500,
                "detail": "Internal server error - weather service temporarily unavailable"
              }
            },
            {
              "statusCode": 503,
              "headers": [
                {
                  "name": "content-type",
                  "value": "application/json; charset=utf-8"
                },
                {
                  "name": "retry-after",
                  "value": "30"
                }
              ],
              "body": {
                "type": "https://tools.ietf.org/html/rfc7231#section-6.6.4",
                "title": "Service Unavailable",
                "status": 503,
                "detail": "Weather service is temporarily overloaded. Please retry after 30 seconds."
              }
            },
            {
              "statusCode": 429,
              "headers": [
                {
                  "name": "content-type",
                  "value": "application/json; charset=utf-8"
                },
                {
                  "name": "retry-after",
                  "value": "60"
                }
              ],
              "body": {
                "type": "https://tools.ietf.org/html/rfc6585#section-4",
                "title": "Too Many Requests",
                "status": 429,
                "detail": "Rate limit exceeded. Please wait 60 seconds before making another request."
              }
            },
            {
              "statusCode": 502,
              "headers": [
                {
                  "name": "content-type",
                  "value": "application/json; charset=utf-8"
                }
              ],
              "body": {
                "type": "https://tools.ietf.org/html/rfc7231#section-6.6.3",
                "title": "Bad Gateway",
                "status": 502,
                "detail": "Unable to connect to weather data provider"
              }
            }
          ]
        }
      ]
    }

    The only thing I had to change was to fix quotes around arguments: --proxy-bypass-list="<-loopback>" --proxy-server="127.0.0.1:8000" (the closing quote behind loopback was missing)

  5. locked and limited conversation to collaborators on Oct 2, 2025
  6. converted this issue into a discussion #1405 on Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions