开发者

Redirect to URL using Regular Expressions in Fiddler

How t开发者_Go百科o Redirect to URL using Regular Expressions in Fiddler?

If URL mathes regex:(?insx)^http://www.(.*)$ respond to http://proxy.exampleproxy.info/?u=(???? what wtite here ???)


You can use AutoResponder tab to provide regex with groups as match rule and use substitution syntax in action string.

For example write this in match rule input:

regex:(?isx).*\.mycdn\.net\/.+\.(jpg|png)\?w=(\d+)&h=(\d+) #matching image urls from cdn

and this in action string input:

*redir:http://lorempixel.com/$2/$3/cats

this rule will match url like this:

http://someimage.mycdn.net/some-directory/some-url.jpg?w=300&h=166

and would redirect to this url

http://lorempixel.com/300/166/cats/

*redir action means that fiddler would respond with 307 code (Temporary Redirect) and Location header with url to redirect. If you omit this string then fiddler would respond with 301 code (Moved Permanently) instead.


fiddler2 doesn't support using the capture text in the response. http://groups.google.com/group/httpfiddler/msg/60e8b897867cdb7b

Need to use rules instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜