Varnish ESI缓存-远程URL返回404

问题描述

我正在尝试在本地设置中使用Varnish ESI缓存。

我确实创建了一个名为index.html的示例html文件

<html>
<body>

    <h1>Hello!!~~</h1>
    <esi:include src="http://noshitdebian.local/paa.txt"/>
    <esi:include src="footer.txt"/>
</body>
</html>

一个ESI标签将源到我的另一个本地服务器,而第二个ESI标签源将在我的Web服务器本地存在。

This is the response I got,404 on the remote and successful for local

看起来清漆在定义的后端服务器上处理请求,这是日志。

https://pastebin.com/7t03A9nP

我的ESI清漆VCL代码https://pastebin.com/kaVmrXqw

如何告诉清漆在远程服务器上查找该资源?

解决方法

看起来清漆在定义的后端服务器上处理请求

这就是Varnish总是 所做的。在esi <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <button onclick="gettronweb()">Can you get tronweb from tronlink?</button> <script> function gettronweb(){ if(window.tronWeb && window.tronWeb.defaultAddress.base58){ document.write("Yes,catch it:",window.tronWeb.defaultAddress.base58) } } </script> </body> </html> 中使用具有域的URL的效果是,将ESI请求中的Host标头设置为域,但不会创建新的后端。该请求仅路由到您已定义的后端。

如何告诉清漆在远程服务器上查找该资源?

定义您要使用的后端,在这种情况下,使用色彩鲜艳的主机src。然后在VCL中编写一条规则,以将请求路由到该后端(大概是在Host标头设置为该值时)。