Varnish 3.0.3 Typo3 and Amazon ELB

Alexander Diedler adiedler at tecracer.de
Wed Jan 30 11:51:01 CET 2013


Hello,
We have an HA-Setup with 3 seperated Typo3 Hostingservers, that are fronted by Varnish 3.0.3 and a Loadbalancer in Front of the two Varnish servers.
Now we are thinking, the Varnish does not cache enough, more content will be loaded from the webservers.
Some of the problems is about the Typo3 Backend users, that must set a cookie, but for the "stateless" loadbalancing we unset the cookies. So we need some help for the configuration for stable environment.
Can somebody help us?

Example Page : http://www.taxofit.de/produkte.html

Out Cache Settings:
backend nginx {
        .host = "10.0.0.10";
        .port = "80";
    }

    sub vcl_recv {
        if (req.http.x-forwarded-for) {
            set req.http.X-Forwarded-For =
            req.http.X-Forwarded-For + ", " + client.ip;
        } else {
            set req.http.X-Forwarded-For = client.ip;
        }

        set req.backend = nginx;

        if (req.request == "POST") {
            ban("req.url == " + req.url);
            set req.http.X-Test = req.url;
            return (pass);
        }

        if (req.http.X-Tx-Solr-Iq) {
           return(pipe);
        }

        if (req.request != "GET" &&
            req.request != "HEAD" &&
            req.request != "PUT" &&
            req.request != "POST" &&
            req.request != "TRACE" &&
            req.request != "OPTIONS" &&
            req.request != "DELETE") {
            return (pipe);
        }
        if (req.request != "GET" && req.request != "HEAD") {
            return (pass);
        }
        if (req.http.Authorization || req.http.Cookie) {
            return (pass);
        }
        if (req.url ~ "/typo3" || req.url ~ "/typo3/install/") {
            ##TYPO3-Backend nicht cachen
            if (req.http.cookie ~ "be_typo_user"){
                ##Inhalten löschen wenn Shift+reload gedrückt wird,aber nur bei eingeloggtem user (Backend-Cookie)
                if (req.http.Cache-Control ~ "no-cache") {
                   set req.ttl = 0s;
                    ban("req.url == " + req.url);
                    return (pass);
                }
            }
            else{
                ##Cookies von TYPO3-Seiten erase
                unset req.http.Cookie;

            }
        } else {
                unset req.http.Cookie;
        }
        return (lookup);
    }

    sub vcl_fetch {
        set beresp.ttl = 12h;
        set req.grace = 24h;
        if (req.url ~ "\.(jpeg|jpg|png|gif|ico|swf|js|css|txt|gz|zip|rar|bz2|tgz|tbz|html|htm|pdf|pls|torrent)$") {
                set beresp.ttl = 48h;
        }
        if (req.url ~ "/typo3" || req.url ~ "/typo3/install/") {
            if (beresp.http.set-cookie ~ "be_typo_user"){
            }
            else{
                unset beresp.http.set-cookie;
            }
        }
        return (deliver);
    }

Best regards
Alexander

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130130/2ca6d10b/attachment.html>


More information about the varnish-misc mailing list