Charles: Rewriting Url Requests (Find a Wii)
Have you ever wanted to manipulate a url request on the fly (change the header, modify query params, etc.)? The reasons for doing this can vary from production debugging to manipulating requests made by another site. Though I haven’t really seen it highlighted, Charles, one of the common tools used by Flash developers for monitoring HTTP traffic has this feature built in. The feature is called rewriting and is quite easy to use.
To explain how to use this feature, I’ll illustrate it with a technique that tricks the Target.com store into telling you where all the Nintendo Wii’s are in your area.
STEPS
- Open Tools -> Rewrite from the application menu
- Select Enabled
- Add a Set, name it Target Wiis, which just gives a label for you to recognize the requests you want to match
- Add a Host, use *.target.com, which will match all request made by target.com
- Add a Rule
- select type Modify Query Param
- in match’s name field type asin (we are going to replace the query param asin with our own custom param)
- in new’s value field type B0009VXBAQ (we are going to replace the product identifier with a Wii console, so we can view results for Wii’s in the area)
- click ok - Go to a product page on Target.com that has a Find at Stores button (sample product page)
- Enable Charles, click the find store button, enter your zip code, the results will not show the product that you clicked but the locations of Nintendo Wiis instead.
This is a great feature, especially if you are wanting to do general request changes. However, if you are doing specific query parameter changes and don’t want to set them up as a stored process, I’d recommend the FireFox plugin Tamper Data. The plugin allows you to view the request data laid out in a form and change it as it is being requested instead of setting it up before hand.
Hopefully this can help someone with their debugging/development process as well as give those searching for a Wii a little trick to use to their advantage.