简体   繁体   English

仅将Varnish用作反向代理而不进行缓存

[英]Using Varnish only as a Reverse Proxy without caching

I'd like to know what can I put in my VCL to tell Varnish to not cache the requests and pass all the requests to the backend, because I would like to use Varnish as a reverse proxy to hide the actual IP of my backends. 我想知道我可以在VCL中放入什么来告诉Varnish不要缓存请求并将所有请求传递给后端,因为我想使用Varnish作为反向代理来隐藏后端的实际IP。 I did some researches but I didn't find anything concrete. 我做了一些研究,但没有发现任何具体内容。 I'm using Varnish 3 and my actual Varnish VCl is: 我正在使用Varnish 3,而我实际的Varnish VCl是:

backend default {
.host = "127.0.0.1";
.port = "8080";
}

Thank you. 谢谢。

if you want varnish to do nothing with the request at all you should use pipe. 如果您希望清漆完全不处理请求,则应使用管道。 This prevents varnish from rewriting the headers. 这样可以防止清漆重写标题。 The response is sent back from varnish directly. 响应从清漆直接发回。

sub vcl_recv {
    return(pipe);
}

You'll need to overwrite the default handling to force a 'pass' 您需要覆盖默认处理以强制执行“通过”

This in both vcl_recv and vcl_fetch 这在vcl_recv和vcl_fetch中

sub vcl_recv { pass; 子vcl_recv {通过; } }

sub vcl_fetch { pass; 子vcl_fetch {通过; } }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM