Testing ESI behind an intranet

I work for a company with a draconian internet policy like most other enterprises whereby I am required to follow certain rules and do not have the ability to bypass certain restrictions.

On of the things that annoys me most is the fact that in my code, I have to get it to proxy requests as well which is quite easily solved by having a single entry point to your external requests (Class, functions) . The problem with this solution is when you don’t have access to the client that is making the request.

So today, I was plodding along doing boring stuff as usual when I was required to get ESI tags working locally that included content from an external box (Think a blog trying to get the headers of the main site coming from ESI). Without a proxy, no problems. But when your using EST by Akamai with no ability to allow external access, things get a bit tricky. So I hacked together this little Varnish VCL which lets me do all my ESI testing properly while still getting remote content and best of all, I can run it on my Macbook which means I no networked dependencies!

First off, I’m going to assume if you’re reading this you don’t need too many pointers so here is the link to the the setup i am pretty much using. Remember, I assume you have vhosts setup properly and have stuff installed properly

Then it’s just a matter of starting varnish with varnishd -f /etc/varnish/default.vcl -a 0.0.0.0:80

Hope this helps someone,
Dave