Configuring varnish amd64 pfsense 2.0



  • So I want to get Varnish working on pfsense 2.0.

    I installed the package, and on backends I see nothign is there, if I add something it asks me for:

    Do I actually need to put in anything? Because I have no idea what to put in for most of these settings.

    And to check if Varnish is working on the VarnishSTAT page, which i don't think it is, it just posts

    VarnishSTAT Server logs as of Mon Dec 20 3:27:50 PST 2010

    Here is the default configuration, is it already setup for me?

    # Varnish configuration file
    # Automatically generated by the pfSense package system
    
    # This file is located in /var/etc/default.vcl
    
    sub vcl_error {
    	set obj.http.Content-Type = "text/html; charset=utf-8";
    synthetic {"
    
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <title>"} obj.status " " obj.response {"</title>
    
     **We are very sorry but an error occurred during this request.** 
    
    Please press refresh in your browser to try again.
    
    Varnish Error "} obj.status " " obj.response {"
    
    "} obj.response {"
    
    ### Guru Meditation:
    
    XID: "} req.xid {"
    
    "};
    return(deliver);
    
    }
    
    sub vcl_recv {
    
    	# If the client sent an X-Forwarded-For header, remove it. 
    	# It cannot betrusted.
    	unset req.http.X-Forwarded-For;
    	# Note that we don't need to add the client ip to the X-Forwarded-For 
    	# header, varnish will do that for us
    	if (req.http.Accept-Encoding) {
    		# Handle compression correctly. Varnish treats headers literally
    		# not semantically. So it is very well possible that there are
    		# cache misses because the headers sent by different browsers
    		# aren't the same.
    		# @see: http:// varnish.projects.linpro.no/wiki/FAQ/Compression
    		if (req.http.Accept-Encoding ~ "gzip") {
    			# if the browser supports it, we'll use gzip
    			set req.http.Accept-Encoding = "gzip";
    		} elsif (req.http.Accept-Encoding ~ "deflate") {
    			# next, try deflate if it is supported
    			set req.http.Accept-Encoding = "deflate";
    		} else {
    			# unknown algorithm. Probably junk, remove it
    			unset req.http.Accept-Encoding;
    		}
    	}
    
    	if (req.request != "GET" && req.request != "HEAD") {
    		return(pipe);
    	}
    	return(lookup);
    }
    
    sub vcl_pipe {
    
    	# If we don't set the Connection: close header, any following
    	# requests from the client will also be piped through and
    	# left untouched by varnish. We don't want that.
    	set req.http.connection = "close";
    	# Note: no "pipe" action here - we'll fall back to the default
    	# pipe method so that when any changes are made there, we
    	# still inherit them.
    
    }
    
    

    Sorry I know nothing about Varnish.




Log in to reply