Followed instruction - DevProxy not intercepting localhost addresses #1224
-
Hi, I have looked at the instructions here and believe I am doing everything right. But I am not seeing any requests intercepted by devproxy that are on localhost addresses (public addresses are logged and intercepted correctly). Configuration file (I've only added one new url) {
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.19.1/rc.schema.json",
"plugins": [
{
"name": "RetryAfterPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll"
},
{
"name": "GenericRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
"configSection": "genericRandomErrorPlugin"
}
],
"urlsToWatch": [
"https://localhost:7271/*",
"https://jsonplaceholder.typicode.com/*"
],
"genericRandomErrorPlugin": {
"errorsFile": "devproxy-errors.json"
},
"rate": 50,
"logLevel": "information",
"newVersionNotification": "stable"
} Starting visual studio and running my project in debug. Testing all is working correctly. Starting devproxy via (actual path ommitted) Launching edge by doing Win + R and using the command I'm sure I am missing something, but if I am, it is not clear what. |
Beta Was this translation helpful? Give feedback.
Replies: 14 comments
-
Hey @cfelstead 👋 Thanks for trying Dev Proxy, apologies for the trouble. Command-line options for proxy settings suggests that you also need to specify the
Try adding the
|
Beta Was this translation helpful? Give feedback.
-
Thanks @garrytrinder. Sadly no change. I am also trying via powershell using the below with no luck. |
Beta Was this translation helpful? Give feedback.
-
Can you tell me more about the local web service? I'll see if I can repro. |
Beta Was this translation helpful? Give feedback.
-
When I experienced the issue I wanted to rule out it being my API somehow. So I’ve replaced it with the default .net 8 weather forecast api. This is a corporate machine so I’m not ruling out it being something to do with the setup there. |
Beta Was this translation helpful? Give feedback.
-
I did some investigation today and can repro, I'll do some more digging tomorrow. |
Beta Was this translation helpful? Give feedback.
-
@cfelstead I tested this scenario with a simple nodejs express API setup running on index.jsconst express = require("express");
const app = express();
app.get("/", (req, res) => {
res.json({ date: new Date() });
});
app.listen(3000, () => {
console.log(`Server is running on port 3000`);
}); devproxyrc.json{
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.19.1/rc.schema.json",
"plugins": [
{
"name": "GenericRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
"configSection": "genericRandomErrorPlugin"
}
],
"genericRandomErrorPlugin": {
"errorsFile": "errors.json"
},
"urlsToWatch": [
"http://localhost:3000*"
]
} errors.json{
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.19.1/genericrandomerrorplugin.schema.json",
"responses": [
{
"statusCode": 500,
"body": "Internal Server Error",
"headers": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
]
} Program.csvar client = new HttpClient();
var response = await client.GetAsync("http://localhost:3000");
Console.WriteLine(response.StatusCode);
Console.WriteLine(await response.Content.ReadAsStringAsync()); Tests
|
Beta Was this translation helpful? Give feedback.
-
Screenshot of web server, proxy and tests |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for you efforts @garrytrinder. I now have the application working as it should, however, only under certain conditions. Here are my notes. I am not ruling out some of these being specific to the work laptop in some way, however, hopefully they will help people in future.
So, in order to get work I did the following.
"urlsToWatch": [
"http://localhost:5256/*",
.......
]
It is worth noting, I have not yet got it working without using curl.exe and specifying the proxy, for example, using a swagger UI. However, I am continuing to test and will report back with any news. |
Beta Was this translation helpful? Give feedback.
-
I can get Firefox to route through devproxy by setting the proxy server to 127.0.0.1:8000 and, in I cannot get Chrome or Edge to behave with the launch command
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the updated info @cfelstead I've been able to confirm that I noticed however that Dev Proxy did not intercept requests unless I used the |
Beta Was this translation helpful? Give feedback.
-
Interesting. I still can’t get it working. I did get the vs debugger working correctly (so dotnet run) as long as the proxy was running prior to the debugger launching. |
Beta Was this translation helpful? Give feedback.
-
I think I’m in a place where it is working enough for me to proceed. It i can provide more assistance, please let me know. Otherwise, I’m happy to close this. |
Beta Was this translation helpful? Give feedback.
-
Thanks @cfelstead, I'll close this, but will work on updating the page to reference some of our findings in this issue. Thanks again for raising the issue, please let us know if there is anything we can help with. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/MicrosoftDocs/microsoft-cloud-pr/pull/332 |
Beta Was this translation helpful? Give feedback.
Thanks for the updated info @cfelstead
I've been able to confirm that
msedge --proxy-bypass-list="<-loopback>" --proxy-server="127.0.0.1:8000"
works for me on Windows 11 and Edge Beta (128.0.2739.5) this morning.I noticed however that Dev Proxy did not intercept requests unless I used the
--proxy-server
option, so we should update our docs to include that.