node.js - Setting up varnish cache with node -
i'm trying configure varnish cache on unbuntu vps. i've got installed , have tried following setup guides , googling etc headers never seem show varnish cacheing.
i running node server on port 3000, but, port 3000 forwarding port 80.. i'm not sure how plays varnish caching. here relevant config options have changed in varnish... , haven't touched else.
file: /etc/varnish/default.vcl
backend default { .host = "127.0.0.1"; .port = "3000"; }
file: /etc/default/varnish
daemon_opts="-a :80 \ -t localhost:80 \ -f /etc/varnish/default.vcl \ -s /etc/varnish/secret \ -s malloc,256m"
if need me provide more information ask, thanks!
if entire vcl file, there multiple reasons why varnish may not caching. first, should read default vcl.
the default vcl caches , head http requests, , won't cache page has cookies. since sites have cookies now-a-days (such google analytics tracking cookies), means sites won't cached default vcl.
you should create own vcl, specific site. example, here documentation on removing cookies. remove cookies don't affect page. reason varnish won't cache pages cookies avoid caching pages login cookies may change page contents (for example, logged in users see names. don't want page cached , served everyone).
Comments
Post a Comment