Using Fiddler as a caching proxy

1,135 views
Skip to first unread message

Starbuck

unread,
Oct 30, 2010, 5:16:46 PM10/30/10
to Fiddler
Zynga games published through Facebook download thousands of assets
into the browser, and I don't think any of them make use of cache. The
performance is awful. I don't think they set ETags nor set expiration
dates on anything. I was thinking it would be neat to turn on Fiddler
just for these applications, run with Fiddler and some extension
serving as a local cache, and then just turn it off for normal
surfing.

Before I venture too far down the path of due diligence, is there an
easy solution to this? Fiddler can clear cache and cookies, but what
about augmenting or manipulating it?

Can I get all files with specific extensions to use local resources on
request rather than going all the way back to remote servers? This
would include all images and many/all SWF files.

Should I just modify responses with expiration headers? (will need to
look into syntax for that)

In the past I've set an OnBeforeResponse to rewrite inbound img tags
for specific hosts with 127.0.0.1. They then load a consistent
placeholder from localhost rather than the real image from the remote
server. But for this cache concept I'm thinking I would need to move
assets into a private directory the first time after they're loaded
(or periodically) so that I have a local cache from which they can
later be retrieved.

For me this is more of a challenge for using the tool itself. But I'm
thinking it would be neat to be able to wrap Fiddler and this new
capability, and publish it for anyone to use with IE or FireFox - sort
of advertising the versatility of Fiddler. That could require
separate download of Fiddler, but wrapping Fiddler in a package that
does this would be fine too. That borders on just being a freeware
offering of a proxy server - as well as possibly stepping over some of
the distribution restrictions for the offering, etc. I don't want to
cross any lines.

Is there a proxy server somewhere that would be more appropriate for
this specific application?

Thanks!

Klaus Johannes Rusch

unread,
Oct 31, 2010, 3:09:00 AM10/31/10
to Starbuck, Fiddler
Starbuck wrote:
> Zynga games published through Facebook download thousands of assets
> into the browser, and I don't think any of them make use of cache. The
> performance is awful. I don't think they set ETags nor set expiration
> dates on anything.
If all you want is change the cacheability of objects by setting headers
differently, Fiddler can do that easily. For example, you could set
Fiddler to respond to any request containing If-Modified-Since or
If-Match headers with a 304 Not modified response (selectively for those
resources you never want to refresh).

> Can I get all files with specific extensions to use local resources on
> request rather than going all the way back to remote servers? This
> would include all images and many/all SWF files.
>
Fiddler can certainly do that too, serving files from local disk or
rerouting requests to another location which has cached (and cacheable)
copies of the original documents.

> Is there a proxy server somewhere that would be more appropriate for
> this specific application?
>
Fiddler will work for this but is more of a diagnostics/development tool
than a Web accelerator, a standard caching proxy may be a better choice
for what you are trying to do, for example http://www.squid-cache.org/

--
Klaus Johannes Rusch
Klaus...@atmedia.net
http://www.atmedia.net/KlausRusch/

EricLaw

unread,
Nov 1, 2010, 6:02:00 PM11/1/10
to Fiddler
The simplest way to have Fiddler act as a Caching Proxy is to drag/
drop responses from the Session List to the AutoResponder. Fiddler
will subsequently replay those responses back to the browser.

As Klaus notes, you could additionally create a new rule that returns
a 304 for any request that contains an If-Modified-Since or If-None-
Match header; that would allow the IE cache to treat everything it has
as a "hit" without requiring network validation.

Or, you could just add a new Cache-Control directive indicating that
all responses are fresh for an hour or whatever you'd like.

If you're not running IE9 yet, you might consider upgrading to the
beta; IE9 includes a substantially improved cache:
http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx

If you do elect to try a "standard" proxy cache like SQUID, you'll
probably need to reconfigure it to cache more aggressively than the
standards allow-- if the responses were cacheable according to the
standards, IE would have already been caching them! :-)
Reply all
Reply to author
Forward
0 new messages