2

I've got a mobile app to test, and the url where requests from mobile app are sent is mapi.example.com, but the company told me that it would be great if I could send all requests to mapitest.example.com. The application response and requests are same for both urls, but the first one is in use and they would really like for me to test on the second url because of possible problems.

How can I set the intercepting proxy to change mapi.example.com to mapitest.example.com?

  • 1
    Are the two apps on the same IP address? It's trickier than it sounds like it should be, since doing match/replace on the header doesn't affect the target (you just send the data to the original IP address, with a changed host header), which throws a lot of people. – Matthew Dec 21 '17 at 21:19
  • @Matthew yeah that is the problem for me, I did replace host through burp match and replace but target can not be changed. No they are in the same subnet though. – Daniel Dec 21 '17 at 21:32
  • 1
    If you change the Hostname Resolution for mapi.example.com to point to the IP address for mapitest.example.com, AND match replace the host header, does that connect to the expected server? Don't have my Burp setup to hand to check. – Matthew Dec 21 '17 at 21:45
  • @PortSwigger Useful to know - didn't want to put it as an answer since I wasn't sure, and I'm glad I didn't! – Matthew Dec 22 '17 at 8:42
  • @Matthew thanks for comments and help, really grateful. – Daniel Dec 22 '17 at 11:03
6

There is a sample extension to do this. Here is the description:

This extension demonstrates how to redirect outgoing HTTP requests from one host to another. This task might arise, for example, if you have mapped out an application which then moves to a different staging URL. By simply redirecting traffic to the new hostname, you can continue to drive your testing from the original site map.

The extension works as follows:

  • It registers itself as an HTTP listener.
  • For outgoing request messages, it retrieves the HTTP service for the request.
  • If the HTTP service host matches the "from" host, it uses a helper method to build a new HTTP service using the "to" host, and other details unchanged.
  • It updates the HTTP request with the new HTTP service.

Note: The sample code uses "host1.example.org" and "host2.example.org" as the "from" and "to" hostnames. You should edit the code to use your own hostnames before using it.

  • What is the option for HTTPS? – Daniel Dec 22 '17 at 11:05
  • 1
    @Daniel - The same. We say "HTTP" when we mean "HTTP or HTTPS" as the latter is a mouthful – PortSwigger Dec 22 '17 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.