Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as C++ by registered user britodfbr ( 12 years ago )
backend default {
 .host = "127.0.0.1";
 .port = "9673";
}

acl purge {
 "localhost";
 "192.0.2.0"/24;
}

sub vcl_recv {
        if (req.http.host ~ "(www.)?example.com") {
                set req.http.host = "example.com";
  set req.url = regsub(req.url, "^", "/VirtualHostBase/http/example.com:80/example.com/VirtualHostRoot");
        } elsif (req.http.host ~ "(www.)?example.org") {
                set req.http.host = "example.org";
  set req.url = regsub(req.url, "^", "/VirtualHostBase/http/example.org:80/example.org/VirtualHostRoot");
        } else {
                error 404 "Unknown virtual host.";
        }

        if (req.request != "GET" && req.request != "HEAD") {
                if (req.request == "POST") {
                        return(pass);
                }
                
                if (req.request == "PURGE") {
                        if (!client.ip ~ purge) {
                                error 405 "Not allowed.";
                        }
                        return(lookup);
                }
        }
        if (req.http.Cookie && req.http.Cookie ~ "__ac(|_(name|password|persistent))=") {
  if (req.url ~ "\.(js|css)") {
                        remove req.http.cookie;
                        return(lookup);
                }
                return(pass);
        }
}

sub vcl_hit {
        if (req.request == "PURGE") {
                purge;
                error 200 "Purged";
        }
}

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

sub vcl_fetch {
        if (beresp.ttl < 3600s) {
                set beresp.ttl = 3600s;
        }
}

 

Revise this Paste

Your Name: Code Language: