Fork me on GitHub

Lolcat'ing the web v0.1

Internet is made of cats A great philosopher

With Haka, you can make it happen. As seen in other blog posts, we have shown that we can modify on the fly HTTP requests. What if we change every image requested by a browser to a lolcat image?

The following rule replaces the requested image ressource (png, gif, and png files) by a lolcat image.

local image_ext = { '.png', '.jpg', '.gif' }

haka.rule{
    hooks = { 'http-request' },
    eval = function (self, http)
        local request = http.request
        local path = request:split_uri()['path'] or ''
        for _,ext in pairs(image_ext) do
            if string.match(path, ext .. '$') then
                -- Ready to lolcat the web? :)
                -- Redirect request to server hosting a lolcat image
                request.uri = "http://myserver/lolcat.jpg"
                break
            end
        end
    end
}

Note that this setup works only through a proxy. Without proxy, the request is sent to the original server which may not have a funny lolcat image.

Here is a sample of our website "lolcatized"!

lolcat