In Fiddler, a small test is performed on sripat and a small test is performed on fiddlersripat.

Source: Internet
Author: User

In Fiddler, a small test is performed on sripat and a small test is performed on fiddlersripat.

From the previous article, I used a simple function of Fiddler, HOSTS for forwarding and debugging of mobile apps, but some people may ask, HOSTS can only change the HOST, if there are the following scenarios, what should I do?

For example, the test server address is 192.168.0.69: 8080. The project name deployed is demo, that is, the complete access address is http: // 192.168.0.69: 8080/demo/

On the official server, the project may be directly deployed to the root directory: http://aip.demo.com

In this case, if you simply use HOSTS, it will not work, because the locally deployed project is not in the root directory, and the system prompts that the resource cannot be found. What should we do? I cannot deploy the project to the root directory for testing. This may affect other projects?


Well, in fact, there is no way to use HOSTS at this time. Another more powerful feature of fiddler should be used: script

On the fiddler page, click the FiddlerScript tag on the right to enter the FiddlerScript Editor (if not installed, Fiddler will prompt you to install it)

There is a Go to selection box under the tag, where you can quickly locate the corresponding method in the script. Here we need to change the request address, so the method we locate must be the OnBeforeRequest method:

Add the following to the OnBeforeRequest method:

        if(oSession.uriContains("www.baidu.com")){            oSession.url = oSession.url.Replace("www.baidu.com","news.sina.com.cn/society/");                           }

Here, we replaced Baidu with the social edition of Sina news. The effect is as follows:


We visited Baidu, but fiddler jumped to the Social edition page of Sina news, which solves the HOSTS deficiency in the previous article.

The functions of FiddlerScript are very powerful. Here I just try it out, which is a valuable reference. If you are interested, please take a closer look.




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.