ttree/cloudflare

Neos CMS add support for full page cache with Cloudflare (event the HTML page)

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Type:neos-package

dev-master 2017-07-18 08:19 UTC

This package is auto-updated.

Last update: 2024-09-26 04:57:21 UTC


README

This package for Neos CMS add support for full page cache with Cloudflare (event the HTML page)

This package is under development, any PR or review are welcome.

created by Dominique Feyer dfeyer@ttree.ch http://www.ttree.ch

Features

  • Tag each request URI with the node that are used in the page rendering
  • Generate the request cache on the first hit on the live workspace
  • Clear the cache on node publication (for all URI where the current node is used)
  • Command Line tools to do some basic thing with the Cloudflare API

Ready for production ?

Currently this package is used in production on our agency website <http://ttree.ch/>_ agency website. But currently the API is not marked has stable and can change in the future. Commit message respect the Neos CMS commit message, and breaking change will be marked with "!!!" on the commit first line.

How to configure cloudflare to cache HTML page ?

By default CF don't cache your HTML page, but only the assets like image, javascript, ...

You can change this default, by using the "Page Rules". Those page rules assume, that you use the ".html" suffix for your page, and that you use Neos. Those rules must be adapted to your own needs, some dynamic pages of your website needs maybe a different caching rules.

  • domain.com/@user-.html (Cache level: Bypass cache)
  • domain.com/neos/* (Cache level: Bypass cache)
  • domain.com/ (Cache level: Cache everything)
  • domain.com/*.html (Cache level: Cache everything)

Those rules, are juste here as an example.

How to use the plugin ?

You need to install the package with composer and configure your settings::

Ttree:
  Cloudflare:
	default:
	  zone: 'need-to-be-configured'
	  apiKey: 'need-to-be-configured'
	  email: 'api@domain.com'
	'domain_com':
	  zone: 'domain.com'
	  apiKey: 'need-to-be-configured'
	  email: 'api@domain.com'

You can use multiple CF account if needed.

Warning: The key (domain_com), must be the CF zone name with "." replaced by "_".

How to generate the cache ?

The cache is generated by a TypoScript2 object, you simply use it in your Site TS2::

include: resource://Ttree.Cloudflare/Private/TypoScripts/Library/NodeTypes.ts2

page = Page {
	[all your page configuration here]
	cache = Ttree.Cloudflare:Cache {
		@position = 'end'
		enable = TRUE
		zone = 'domain.com'
	}
}

With a proper configuration, you will be hanble to handle a lots of load without killing your server. Keep your CPU time to support your contributors.

Whish List

  • Custom page expiration HTTP headers
  • Better test coverage
  • Some advanced configuration documentation
  • Job Queue support to generate the page cache after purging the cache

Acknowledgments

Development sponsored by ttree ltd - neos solution provider.

We try our best to craft this package with a lots of love, we are open to sponsoring, support request, ... just contact us.

License

The MIT License (MIT). Please see LICENSE for more information.