Varnish/Plone css not found

Fu Kite (Eric Labelle) eric.a.labelle at gmail.com
Tue Nov 17 17:21:32 CET 2009


Hi

I'm a total newb to varnish but here is my problem:

When I connect to my plone site directly there is no problem however the
moment i use varnish none of the css loads and all that loads is the html...
pressing on plone's links to validate css returns that none of the css files
are found when going through varnish.

here is my vcl config:

#
# This is an example VCL configuration file for varnish, meant for the
# Plone CMS running within Zope.  It defines a "default" backend for
# serving static content from a normal web server, and a "zope"
# backend for requests to the Zope CMS
#
# See the vcl(7) man page for details on VCL syntax and semantics.
#
# $Id: zope-plone.vcl 3300 2008-10-15 09:52:15Z tfheen $
#

# Default backend definition.  Set this to point to your content
# server.

# Default backend is the Zope CMS
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

acl purge {
    "localhost";
}

sub vcl_recv {

    # Normalize host headers, and do rewriting for the zope sites.  Reject
    # requests for unknown hosts
        if (req.http.host ~ "(www.)?parctechno.mediacommune.org") {
                set req.http.host = "parctechno.mediacommune.org";
                set req.url = "/VirtualHostBase/http/
parctechno.mediacommune.org/2/VirtualHostRoot/" req.url;
        } else {
                error 404 "Unknown virtual host.";
        }

        /* Do not cache if request is not GET or HEAD */
        if (req.request != "GET" && req.request != "HEAD") {
            /* Forward to 'lookup' if request is an authorized PURGE request
*/
            if (req.request == "PURGE") {
                if (!client.ip ~ purge) {
                    error 405 "Not allowed.";
                }
                lookup;
            }
            pipe;
        }

        /* Do not cache if request contains an Expect header */
        if (req.http.Expect) {
            pipe;
        }

        /* Varnish doesn't do INM requests so pass it through */
        if (req.http.If-None-Match) {
            pass;
        }

        /* Always cache images and multimedia */
        if (req.url ~
"\.(jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|mp3|mp4|m4a|ogg|mov|avi|wmv)$") {
            lookup;
        }

        /* Always cache CSS and javascript */
        if (req.url ~ "\.(css|js)$") {
            lookup;
        }

        /* Always cache static files */
        if (req.url ~

"\.(pdf|xls|vsd|doc|ppt|pps|vsd|doc|ppt|pps|xls|pdf|sxw|zip|gz|bz2|tgz|tar|rar|odc|odb|odf|odg|odi|odp|ods|odt|sxc|sxd|sxi|sxw|dmg|torrent|deb|msi|iso|rpm)$")
{
            lookup;
        }

        /* Do not cache when authenticated via HTTP Basic or Digest
Authentication */
        if (req.http.Authenticate || req.http.Authorization) {
            pipe;
        }

        /* Do not cache when authenticated via "__ac" cookies */
        if (req.http.Cookie && req.http.Cookie ~
"__ac_(name|password|persistent)=") {
            pipe;
        }

        /* Do not cache when authenticated via "_ZopeId" cookies */
        if (req.http.Cookie && req.http.Cookie ~ "_ZopeId=") {
            pipe;
        }

        lookup;
    }

    sub vcl_hit {
        if (req.request == "PURGE") {
            set obj.ttl = 0s;
            error 200 "Purged";
        }
    }

    sub vcl_miss {

        /* Varnish doesn't do IMS to backend, so if not in cache just pass
it through */
        if (req.http.If-Modified-Since) {
            pass;
        }

        if (req.request == "PURGE") {
            error 404 "Not in cache";
        }
    }

Like i said the pages seem to load fine only the css is missing. :S

Sorry if it's something really obvious to you guys but i've been butting my
head up against this since i installed varnish last night and i can't seem
to find any info googling it :(

-- 
Eric Labelle
(Dubian)
________________________________
Dubearth Collective - www.dubearth.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20091117/6340a748/attachment-0001.html>


More information about the varnish-misc mailing list