Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用heroku应用程序设置Varnish-我使用什么后端主机和端口?_Heroku_Varnish - Fatal编程技术网

使用heroku应用程序设置Varnish-我使用什么后端主机和端口?

使用heroku应用程序设置Varnish-我使用什么后端主机和端口?,heroku,varnish,Heroku,Varnish,我正在尝试用我的Heroku应用程序设置一个Varnish服务器。我在设置后端主机和端口以指向heroku应用程序时遇到困难 我试着这样进入它: backend default { .host = "gavedrysset-api.herokuapp.com"; .port = "80"; } 这不起作用,给我一个heroku错误页面,上面写着: Heroku | No such app There is no app configured at that hostname.

我正在尝试用我的Heroku应用程序设置一个Varnish服务器。我在设置后端主机和端口以指向heroku应用程序时遇到困难

我试着这样进入它:

backend default {
    .host = "gavedrysset-api.herokuapp.com";
    .port = "80";
}
这不起作用,给我一个heroku错误页面,上面写着:

Heroku | No such app

There is no app configured at that hostname.
Perhaps the app owner has renamed it, or you mistyped the URL.

我如何让varnish指向我的heroku应用程序?

我想出了一个解决方案。但是我不知道我在做什么。。。 在线程中找到了答案

我将此添加到default.vcl:

sub vcl_recv {
    set req.http.host = "gavedrysset-api.herokuapp.com";
}

您可能没有传递所需的主机头或类似的消息。无论如何,你为什么要这样做?我感觉我误解了一些基本的东西。我想用varnish来缓存我heroku应用程序中的静态内容,我想我必须将我的heroku应用程序设置为“后端默认值”才能实现这一点?后端默认配置去哪里了?你的varnish服务器在哪里?通常我会说只把静态内容放在cdn中,或者使用类似cloudflare的东西。varnish服务器位于欧洲的vps上。我很乐意使用cdn,但在这种情况下,我这么做只是因为我想了解清漆。我想我可以用我的一个heroku应用程序来尝试varnish,以达到学习的目的。