Using a proxy to capture http requests in dotnet

Nick Lydon
Jan 20, 2022

--

Sometimes you want to use a proxy to capture http requests, for example to check if a specific header is being set. This is easy to accomplish using the postman application, which you probably already have installed.

  1. Set the environment variable “HTTP_PROXY” to “http://localhost:5555". You can add this in your localSettings.json file for example.
  2. Enable capturing requests in postman. You can see from the screenshot that port 5555 is being used, the same port as set in step 1. I’ve chosen to record requests in a collection called “Captured”, created explicitly for this purpose.
The modal for enabling capture of requests in postman

When you start your application you should see the requests being added to the collection you selected in step 2.

--

--

Nick Lydon
Nick Lydon

Written by Nick Lydon

British software developer working as a freelancer in Berlin. Mainly dotnet, but happy to try new things! https://github.com/NickLydon

No responses yet