I'me trying to configure Varnish to not use cache for specific IPs.
I've configured Varnish 4 on Centos with Apache using Pound to manage HTTPS requests.
I've tried to follow this approach:
Varnish - Bypass Cache for IP Address
based on
https://zcentric.com/2012/03/16/varnish-acl-with-x-forwarded-for-header/
using some C code to manage the IPs. The suggested code is for Varnish3 (e.g. "sp" doesn't exist anymore, now there's a ctx variable)
I've tried to use this approach Inline C Varnish (VCL_deliver) but I get a *"initialization from incompatible pointer type [-Werror] in struct sockaddr_storage client_ip_ss = VRT_r_client_ip(ctx); " error probably because the type has also been changed.
The code I'm trying to use is:
struct sockaddr_storage *client_ip_ss = VRT_r_client_ip(ctx);
struct sockaddr_in *client_ip_si = (struct sockaddr_in *) client_ip_ss;
struct in_addr *client_ip_ia = &(client_ip_si->sin_addr);
const struct gethdr_s hdr = { HDR_REQ, "20X-Forwarded-For:" };
char *xff_ip = VRT_GetHdr(ctx, &hdr);
but I'm doing something wrong.
I'm a bit lost now, how can I disable varnish for specific IPs on Varnish 4 ?
Thanks