Personal tools

Fixing Kupu in deliverance configuration

by FinnArild — last modified Jan 09, 2010 07:20 PM

I am running some websites, which is helping to pay for the rent of the dedicated server I am running this website on. The system I am running is Plone, and I have been asked by people in the Plone community to blog about the solutions I frequently find.

For my newest customer, Ignarbakke (Not quite finished, so disregard the shabby design) - I have for the first time set up a deliverance solution. Deliverance is a brilliantly smart concept, both separating design from logic and giving you some neat possibilities of seamlessly combining several types of backend web applications into a frontend.

However, I have been having some problems in making it play nicely - both with issues in my Varnish cache frontend, and problems with the Kupu editor in Plone. Firstly, I had problems logging in to the site since my Varnish cache kept caching my pages even if I was logged in. This turned out to be a problem with all my sites, but since I usually log in with https which bypasses my cache, I hadn't noticed. The issue was easily solved by adding the following lines to vcl_fetch in the Varnish config:

    } elsif (req.http.cookie ~ "__ac" || obj.http.set-cookie ~ "__ac") {
        set obj.http.Cache-Control = "max-age=0, s-maxage=0, no-cache, must-revalidate, proxy-revalidate";
        set obj.ttl = 0s;
        set obj.http.X-Finns-Varnish-Rule = "Plone logged in - do not cache";

(This is one of several conditions in vcl_fetch - hence the "elsif")

The other problem was that editing pages with the Kupu editor just didn't work. This was a bit more puzzling to me, and I googled my way until I found this page which shed some light on the mystery - however without solving it. I understood that Kupu depended on a pristine /emptypage - so I modified the Deliverance configuration in the example to the following:

    <match  path="contains:emptypage" class="emptypage">                                                             
        <dest href="http://localhost:8080/VirtualHostBase/http/" />         
    <rule class="emptypage">
        <replace content="element:/html/head"  theme="element:/html/head"  />                                        
        <replace content="element:/html/body"  theme="element:/html/body"  />                                        

Basically I used a match instead of a proxy - and that solved my problems nicely. Hopefully this will help others with the same problems.