How do I monitor all incoming http requests?

后端 未结 9 943
南方客
南方客 2020-12-07 09:01

I need to monitor my application from incoming http POST and GET requests originating from outside and sometimes inside the machine.

Is th

9条回答
  •  猫巷女王i
    2020-12-07 09:29

    What you need to do is configure Fiddler to work as a "reverse proxy"

    There are instructions on 2 different ways you can do this on Fiddler's website. Here is a copy of the steps:


    Step #0

    Before either of the following options will work, you must enable other computers to connect to Fiddler. To do so, click Tools > Fiddler Options > Connections and tick the "Allow remote computers to connect" checkbox. Then close Fiddler.

    Option #1: Configure Fiddler as a Reverse-Proxy

    Fiddler can be configured so that any traffic sent to http://127.0.0.1:8888 is automatically sent to a different port on the same machine. To set this configuration:

    1. Start REGEDIT
    2. Create a new DWORD named ReverseProxyForPort inside HKCU\SOFTWARE\Microsoft\Fiddler2.
    3. Set the DWORD to the local port you'd like to re-route inbound traffic to (generally port 80 for a standard HTTP server)
    4. Restart Fiddler
    5. Navigate your browser to http://127.0.0.1:8888

    Option #2: Write a FiddlerScript rule

    Alternatively, you can write a rule that does the same thing.

    Say you're running a website on port 80 of a machine named WEBSERVER. You're connecting to the website using Internet Explorer Mobile Edition on a Windows SmartPhone device for which you cannot configure the web proxy. You want to capture the traffic from the phone and the server's response.

    1. Start Fiddler on the WEBSERVER machine, running on the default port of 8888.
    2. Click Tools | Fiddler Options, and ensure the "Allow remote clients to connect" checkbox is checked. Restart if needed.
    3. Choose Rules | Customize Rules.
    4. Inside the OnBeforeRequest handler, add a new line of code:
      if (oSession.host.toLowerCase() == "webserver:8888") oSession.host = "webserver:80";
    5. On the SmartPhone, navigate to http://webserver:8888

    Requests from the SmartPhone will appear in Fiddler. The requests are forwarded from port 8888 to port 80 where the webserver is running. The responses are sent back through Fiddler to the SmartPhone, which has no idea that the content originally came from port 80.

提交回复
热议问题