Varnish Issues with Multiple IPs

grayloon

Well-Known Member
Oct 31, 2007
117
4
68
Evansville, IN
cPanel Access Level
Root Administrator
Twitter
I've had varnish running port 80 in front of apache running on port 8080 for 18 months. Last night, varnish just died. The only changes I made were the addition of some IP addresses to the server. I was able to workaround the issue by shutting down varnish and switching apache to listen on port 80, but this is temporary.

I have a few sites with an SSL. I assigned each of those sites to use a unique IP address. How can I tell varnish to recognize and properly route those domains to the correct IP? I tried this in my default.vcl file, but I'm getting the cPanel 404 error page when I try to access domain-a.com. Here's what I tried:
Code:
backend default {
        .host = "1.2.3.4";
        .port = "80";
        .connect_timeout = 600s;
        .first_byte_timeout = 600s;
        .between_bytes_timeout = 600s;
}
backend unique {
        .host = "5.6.7.8";
        .port = "80";
        .connect_timeout = 600s;
        .first_byte_timeout = 600s;
        .between_bytes_timeout = 600s;
}
sub vcl_recv {
        if (req.http.host ~ "^(www\.)?domain-a\.com$" || req.http.host ~ "^secure\.domain-a\.com$") {
                set req.backend = unique;
        } else {
                set req.backend = default;
 	}
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Hello :)

It's important to keep in mind that Varnish is not natively supported by cPanel. You may receive more input directly from the developers of Varnish or the developers of the installation script you used to install it.

Thank you.