Varnish plus cloudflare - magento

I found this article while searching if there is any VCL tweak that needs to be done while using varnish and cloudflare. I have currently not included the below tweaks suggested by cloudflare. Can anyone suggest if this is really needed?
Cloudflare varnish VCL configuration

Not a must do, but it may be a good idea to strip not-needed cookies, so that you can cache as much as you can.
Perhaps try with and without the snippet and check which behaviour works best for your use case.

Related

DNN serves "fresh" pages to crawlers. How do I make it serve cached pages to crawlers?

Serving uncached ("fresh") pages to crawlers like Googlebot is a default DNN behavior, according to DNN. Many of our website's pages are heavy and we utilize DB caching extensively.
What setting can I tweak to serve cached pages to crawlers? I could not find anything in web.config or rules.config that seemed related to that. Is it something I need to add?
I found no documentation googling for it. Please help. Thanks!
There is nothing in the DNN Platform that serves content differently to crawlers than that of regular visitors to the site, so they should be seeing the same thing that the rest see.

Varnish cache doesn't hit first time

I just learned and implemented varnish reverse proxy to increase my website speed.
Everything works fine but something minor bothers me.
For some reason, when I check page TTFB for the first time, I get .999s, however, when I rerun the test the number drops to .237s.
I use the following website to check TTFB:
https://www.webpagetest.org
and my website is:
https://www.findfestival.com/
It makes me wonder if the first request to the website hits the cache. When I use curl I can see x-varnish but still it's strange that first time clicking on links are slower compared to the second time clicking on them. (specifically on mobile)
Can you please help me understand why first time Varnish cache doesn't hit?
This is my default.vcl is:
Thanks,
PS, I have seen this post and already tried the solution with no luck!
Varnish Cache first time hit
Seeing how you have X-Mod-Pagespeed in your headers and minimalistic VCL, the conclusion is that you need to take a look at Downstream Caching and make sure that PageSpeed would not send Cache-Control: max-age=0, no-cache which breaks Varnish caching for the most part.
In my own experience, Pagespeed does not play well with Varnish even with downstream caching configuration applied.
It "loves" to send the aforementioned header no matter what. Even if you manage to turn this behaviour off, it results in PageSpeed's own assets not having proper Cache-Control headers plus a few more interesting issues like causing Varnish "hit-for-pass" when rebeaconing has to take place - which is really bad and breaks caching further.
Also have a look at possible configurations. You might want to put PageSpeed at your SSL terminator level (option #1) - that way you don't need Downstream Cache configuration and PageSpeed will be "in front" of Varnish.

CloudFlare permanently caches page even though cookies are set

I had this problem where CloudFlare wouldn't cache any of my pages because all of my pages returned session cookies. I've fixed this with a own written method, which removes unnecessary cookies from my response header. It's based on the same idea used and described here https://github.com/HaiFangHui/sessionmonster.
Currenlty i'm having this situation which is driving me bananas and i was hoping someone could help me out a little bit with your expertise about this subject.
I'm having this problem that after i login within my site after CloudFlare had it's chance to cache the page in a previous request... It will do that permanently untill the Edge TTL time expires.
Since the official CloudFlare documentation states it will not cache a page if it contains cookies i was hoping that after a succesfull login attempt it will serve a live/personalized version of the page. But so it seems that is not the case.
Does somebody know if this is normal? Of course i'm interested in knowing a way to circumvent this. I'm wondering how other sites solves this problem. My assumption would be i wouldn't be the first one having this issue.
Any advice regarding this subject would be greatly appreciated.
So it seems like supplying a "Bypass cache" setting is the solution.
It's only available on a paid plan.
More info: https://blog.cloudflare.com/caching-anonymous-page-views/

Varnish W3C like format logging

I'm new to varnish and I'm setting up for some of the websites I manage.
One of the difficulties I'm having is to debug it. I know that there's varnishlog, but it would be really helpful to have something similar to W3C logging for all request served by varnish. In addition to standard fields, there will be one extra field to show if the request was served from cache, from back-end, etc.
Is there something like this or a way to have this kind of log?
Thanx,
Albert
For anyone looking for this, the solution is varnishncsa

Caching with Cedar/Memcache/Rails 3.1

So I have been trying to get caching to work on my private website, which basically just serves static stuff with little dynamic stuff in it. Since I am going to deply to Heroku Cedar, I have to go with Memcache instead of Varnish. However, I do not seem to be able to make it cache.
I always get cache: stale, invalid, store.
The way I cache is to set the appropriate config params, and use the built-in cache_pages method of ActionController. Can someone help me debugging this?
I see the same. But it looks like page caching works.
So i decided to use Cloudflare for caching, after a couple days of running, i received significant boost in performance/caching.

Resources