Does the Varnish part of your stack have a different IP?
Your Varnish IP must be one of the IPs that Varnish is listening on. 127 and 0 are internal IPs, not the ones Varnish listens on. Usually….
Dear Epstein,
Thanks for your reply. As previously explained, only Nginx is open to access from internet. Nginx and Varnish are in the same host. To be able to use Varnish IP, I open varnish at port 6081 and fill the server host IP for Vanish IP. Not working.
I modify Varnish VCL to include below trying to include as much IP’s as possible. Can you spot any error or possible solution. I have searched and tried for weeks.
vcl 4.0;
import directors;
backend default {
.host = “balancer2”; # IP or Hostname of backend
.port = “80”; # Port Apache or whatever is listening
.connect_timeout = 600s;
.first_byte_timeout = 600s;
.between_bytes_timeout = 600s;
.max_connections = 128;
}
acl cloudflare {
“localhost”;
“127.0.0.1”;
“35.229.143.125”;
“n6.wooshop.com.tw”;
“172.16.128.4”;
“172.17.0.6”;
“172.16.0.0/16”;
“172.17.42.1/16”;
“172.17.0.0/16”;
“172.16.1.0/24”;
“::1”;
}
acl purge {
“localhost”;
“127.0.0.1”;
“35.229.143.125”;
“n6.wooshop.com.tw”;
“172.16.128.4”;
“172.17.0.6”;
“172.16.0.0/16”;
“172.17.42.1/16”;
“172.17.0.0/16”;
“172.16.1.0/24”;
“::1”;
}
import std;
include “lib/xforward.vcl”;
include “lib/cloudflare.vcl”;
include “lib/purge.vcl”;
sub vcl_recv {
# Remove has_js and Cloudflare/Google Analytics __* cookies.
set req.http.Cookie = regsuball(req.http.Cookie, “(^|;\s*)(_[_a-z]+|has_js)=[^;]*”, “”);
# Remove a “;” prefix, if present.
set req.http.Cookie = regsub(req.http.Cookie, “^;\s*”, “”);
# Remove the cloudflare cookie
set req.http.Cookie = regsuball(req.http.Cookie, “__cfduid=[^;]+(; )?”, “”);
….
Dear Epstein,
Just to close it. It is solved. Thanks for your support and the awesome work.