Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#2 proxy.pac support

Matthew L Daniel

This may be just silly, but I like it so I implemented
it. I taught Middleman how to serve its own proxy.pac,
complete with dynamic PROXY list and testing for the
browser configuration address. This enables me to do
much more sick and twisted things than Mozilla allows
and still only running one "webserver" on my machine.

The gist is that it provides the proxy.pac header
(function decl, proxy port list variable, simple host
checks, etc) and you provide the body via the
[well-thought-out] template named 'proxy.pac'. If
Middleman receives a HTTP request (in contrast to a
proxy request) for /proxy.pac, it will happily deliver one.


  • Add support for proxy.pac

  • Logged In: YES

    Great idea...

    I implemented this a little different than your patch though..

    I added two new variables that can be used in templates: $INTERFACE
    and $PORT, which expand to the interface and port number the
    connection was accepted on, respectively.

    so then.. all one would need to do is make a template with the

    function FindProxyForURL(host, url) {

    I added this as one of the built in templates, named "proxy.pac"

    It also doesn't check if the request is for "/proxy.pac", I try to avoid
    adding things like that as they may interfere with some peoples
    configuration (i.e. transparent proxying), the only exception to this rule
    I've made is for "/mman". Instead, to use this feature one could add a
    redirect entry which redirects requests for "/proxy.pac" to

  • Logged In: YES

    The advantages of truly understanding the system, versus
    stapling things onto the outside. ;-)

    Thanks so much for accepting my patch. I think MiddleMan is
    a great proxy and have enjoyed its usage very much. It makes
    me feel very good to be able to contribute something toward
    making it even better.

    • status: open --> closed