Cloudflare and caching sections users aren't allowed into - cloudflare

This is just a question out of curiosity.
How is it that Cloudflare is able to cache my admin panel? How do they do it?

By default, Cloudflare only caches files that should be static all the time (images, css, js, etc.). You can use Page Rules to configure caching of HTML; but, by default, Cloudflare should not cache user-specific markup.
More info from Cloudflare

Related

Will cloudflare cache things by default?

The help section of Caching -> Configuration -> Caching Level says:
Note: By default, Cloudflare does not cache HTML content. You can create a Page Rule to cache static HTML content.
I have no page rules set yet. But when I goto Analytics, I see there are 600+ cached requests. Anybody know what happened here?
As the note says "By default, Cloudflare does not cache HTML content.". That means your .html files are not cached but other assets like images, javascript or fonts are.
Here a list of filetypes that will be cached by default:
https://developers.cloudflare.com/cache/about/default-cache-behavior#default-cached-file-extensions

Serve images via Cloudfront while using mod_pagespeed with Apache

We have mod_pagespeed on Apache and filters like convert_jpeg_to_webp.
We would however, also like to add CDN to the website, especially for the images and javascript files, in order to further enhance the performance and the Pagespeed score for this website. However, once we enable CDN, jpeg versions of the image are delivered via the CDN. We would like, however, to get the webp versions of the images (which work totally as expected) like when CDN is not enabled.
For example, without cdn, www.domainname.com/assets/images/imagename.jpg.pagespeed.ce.fqqfe4pa.jpg
is converted to
www.domainname.com/assets/images/imagename.jpg.pagespeed.ce.fqqfe4pa.webp
But with CDN enabled, we get something like this in return:
cdn.domainname.com/assets/images/imagename.jpg.pagespeed.ce.fqqfe4pa.jpg
Anyone maybe has a solution?
Have you authorized your CDN domain? You can find further details here: https://www.modpagespeed.com/doc/domains

Cloudflare minify html and gzip

Hi I have a Drupal 6 site with Cloudflare as cdn. I also have gzip enabled via apache server setting.
I want to know if I can enable gzip along with Cloudflare html minify? Thanks
Cloudflare dynamically GZips content on supported browsers, and presents this to the end user. This works regardless of whether HTML minify is turned on or off.
Related:
What will Cloudflare gzip?
Does Cloudflare gzip resources?

Disallow crawling of the CDN site

So I have a site http://www.example.com.
The JS/CSS/Images are served from a CDN - http://xxxx.cloudfront.net OR http://cdn.example.com; they are both the same things. Now the CDN just serves any type of file, including my PHP pages. Google somehow got crawling that CDN site as well; two site actually - from cdn.example.com AND from http://xxxx.cloudfront.net. Considering
I am NOT trying set up a subdomain OR a mirror site. If that happens, that is a side affect of me trying to set up a CDN.
CDN is some web server, not necessarily an Apache. I do not know what type of server would that be.
There is no request processing on CDN. it just fetches things from origin server. I think, you cannot put custom files out there on the CDN; it just fetches things from the origin server. Whatever you need to put on the CDN comes from the origin server.
How do I prevent the crawling of PHP pages?
Should I allow crawling of images from cdn.example.com OR from example.com? The links to images inside the HTML are all to cdn.example.com. If I allow crawling of images only from example.com, then there is practically nothing to crawl - there are no links to such images. If I allow crawling of images from cdn.example.com, then does it not leak away the SEO benefits?
Some alternatives that I considered, based on stackoverflow answers:
Write custom robot_cdn.txt and serve that custom robots_cdn.txt based on HTTP_HOST. This is as per many answers on the stack overflow.
Serve a new robots.txt from subdomain. As I explained above, I do not think that CDN can be treated like a subdomain.
Do 301 redirects when HTTP_HOST is cdn.example.com to www.example.com
Suggestions?
Questions related to this, e.g. How Disallow a mirror site (on sub-domain) using robots.txt?
You can put robots.txt in your root directory so that it will be served with cdn.-yourdomain-.com/robots.txt. In this robots.txt you can disallow all the crawlers with the below setting
User-agent: *
Disallow: /

How to disable css access outside from hosting domain?

I've a web app served by Apache, html pages sent to browsers include several CSS files that are hosted at same web app domain.
I've noticed some websites use my css (and images) including in their pages but this increase my (limited) Apache server traffic.
I want to allow css access only for pages hosted at specific domain(s).
How can I configure the web server (Apache) to refuse serving css outside specific domain(s)?
Example (valid access)
myhost.com/index.html contains inclusion for styles/mystyles.css
Example (invalid access)
foreignhost.com/index.html contains inclusion to myhost.com/styles/mystyles.css
Hotlinking can be prevented with .htaccess files, but it might be more fun to change the URL of your CSS files and put up a file at the old URL that makes their entire site hot pink.