title: Varnish 4 + Pounds - Bypass cache for specific IP Address
body: <p>I'me trying to configure Varnish to not use cache for specific IPs.</p>
  
  <p>I've configured <strong>Varnish 4</strong> on <strong>Centos</strong> with <strong>Apache</strong> using <strong>Pound</strong> to manage HTTPS requests.</p>
  
  <p>I've tried to follow this approach: </p>
  
  <p><a href="https://stackoverflow.com/questions/18645182/varnish-bypass-cache-for-ip-address">Varnish - Bypass Cache for IP Address</a></p>
  
  <p>based on</p>
  
  <p><a href="https://zcentric.com/2012/03/16/varnish-acl-with-x-forwarded-for-header/" rel="nofollow noreferrer">https://zcentric.com/2012/03/16/varnish-acl-with-x-forwarded-for-header/</a></p>
  
  <p>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)</p>
  
  <p>I've tried to use this approach <a href="https://stackoverflow.com/questions/25688448/inline-c-varnish-vcl-deliver">Inline C Varnish (VCL_deliver)</a> but I get a *"initialization from incompatible pointer type [-Werror] in struct sockaddr_storage <em>client_ip_ss = VRT_r_client_ip(ctx); "</em> error probably because the type has also been changed.</p>
  
  <p>The code I'm trying to use is: </p>
  
  <pre><code>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 = &amp;(client_ip_si-&gt;sin_addr); 
  const struct gethdr_s hdr = { HDR_REQ, "20X-Forwarded-For:" }; 
  char *xff_ip = VRT_GetHdr(ctx, &amp;hdr);
  </code></pre>
  
  <p>but I'm doing something wrong.</p>
  
  <p>I'm a bit lost now, how can I disable varnish for specific IPs on Varnish 4 ?</p>
  
  <p>Thanks</p>