我正在尝试将Varnish配置为不对特定IP使用缓存。
我已在 Centos 上使用 pound 在 Apache 上配置了 Centos 的 Varnish 4 。
>我尝试遵循这种方法:
Varnish - Bypass Cache for IP Address
基于
https://zcentric.com/2012/03/16/varnish-acl-with-x-forwarded-for-header/
使用一些C代码来管理IP。建议的代码适用于Varnish3(例如,“ sp”已经不存在,现在有一个ctx变量)
我尝试使用此方法Inline C Varnish (VCL_deliver),但是在结构sockaddr_storage client_ip_ss = VRT_r_client_ip(ctx);“ 错误中,从不兼容的指针类型[-Werror]初始化了*”可能是因为类型也已更改。
我要使用的代码是:
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);
但是我做错了事。
我现在迷路了,如何在Varnish 4上为特定IP禁用清漆?
谢谢