Version Notes
- added store and currency switch support
- added advanced message handling
- added Varnish ESI support for basic blocks (sidebar/mini cart, top links, welcome message, last viewed and compared products)
- raised Magento version requirements to CE 1.5.1 and EE 1.9
- dropped support for Varnish 2.x
- moved configuration in separate tab
- small bugfixes
Download this release
Release Info
Developer | Magento Core Team |
Extension | Varnish_Cache |
Version | 4.0.0 |
Comparing to | |
See all releases |
Code changes from version 3.1.2 to 4.0.0
- README_VARNISH_CACHE.txt +184 -89
- app/code/community/Phoenix/VarnishCache/Block/Adminhtml/Cache/Additional.php +1 -1
- app/code/community/Phoenix/VarnishCache/Block/Adminhtml/System/Config/Fieldset/RouteTTL.php +2 -2
- app/code/community/Phoenix/VarnishCache/Block/Adminhtml/System/Config/Fieldset/Versioninfo.php +7 -4
- app/code/community/Phoenix/VarnishCache/Helper/Cache.php +100 -11
- app/code/community/Phoenix/VarnishCache/Helper/Control/Catalog/Category.php +3 -3
- app/code/community/Phoenix/VarnishCache/Helper/Control/Catalog/Product.php +3 -3
- app/code/community/Phoenix/VarnishCache/Helper/Control/Cms/Page.php +3 -3
- app/code/community/Phoenix/VarnishCache/Helper/Data.php +3 -3
- app/code/community/Phoenix/VarnishCache/Model/Catalog/Category/Product.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Catalog/Product/Relation.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Cms/Page/Store.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Control.php +3 -3
- app/code/community/Phoenix/VarnishCache/Model/Control/Abstract.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Control/Catalog/Category.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Control/Catalog/Product.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Control/Cms/Page.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Observer.php +148 -66
- app/code/community/Phoenix/VarnishCache/Model/Processor.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Category/Product.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Category/Product/Collection.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Product/Relation/Collection.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Cms/Page/Store.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Cms/Page/Store/Collection.php +1 -1
- app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Core/Url/Rewrite/Collection.php +1 -1
- app/code/community/Phoenix/VarnishCache/controllers/Adminhtml/VarnishCacheController.php +1 -1
- app/code/community/Phoenix/VarnishCache/etc/config.xml +45 -14
- app/code/community/Phoenix/VarnishCache/etc/default_2.1.vcl +0 -241
- app/code/community/Phoenix/VarnishCache/etc/default_3.0.vcl +44 -42
- app/code/community/Phoenix/VarnishCache/etc/system.xml +27 -14
- app/code/community/Phoenix/VarnishCache/sql/varnishcache_setup/install-4.0.0.php +35 -0
- app/design/adminhtml/default/default/layout/varnishcache.xml +1 -1
- app/design/adminhtml/default/default/template/varnishcache/cache/additional.phtml +1 -1
- app/etc/modules/Phoenix_VarnishCache.xml +1 -1
- app/etc/varnishcache.xml +1 -1
- app/locale/de_DE/Phoenix_VarnishCache.csv +1 -1
- app/locale/en_US/Phoenix_VarnishCache.csv +1 -1
- app/locale/es_ES/Phoenix_VarnishCache.csv +1 -1
- app/locale/fr_FR/Phoenix_VarnishCache.csv +1 -1
- app/locale/nb_NO/Phoenix_VarnishCache.csv +1 -1
- package.xml +11 -5
README_VARNISH_CACHE.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
/*******************************************************************************
|
2 |
*
|
3 |
-
* PageCache powered by Varnish – Documentation
|
4 |
*
|
5 |
-
* Copyright 2011 by PHOENIX MEDIA GmbH
|
6 |
*
|
7 |
* "VARNISH" is a registered trademark of Varnish Software AB (http://www.varnish-software.com/)
|
8 |
-
* "Magento" is a registered trademark of
|
9 |
*
|
10 |
******************************************************************************/
|
11 |
|
@@ -19,12 +19,13 @@ Table of contents
|
|
19 |
4.1 PageCache module
|
20 |
4.2 Varnish Cache (VCL)
|
21 |
4.3 PageCache Crawler
|
|
|
22 |
5. Cache cleaning, PURGE requests
|
23 |
6. VCL Design Exceptions
|
24 |
7. Troubleshooting
|
25 |
7.1 Known issues
|
26 |
7.2 Prevent caching for custom modules
|
27 |
-
7.3 Prevent caching for HTML/PHP files
|
28 |
7.4 Debugging requests
|
29 |
7.5 Vary HTTP header for User-Agent
|
30 |
8. Changelog
|
@@ -33,8 +34,8 @@ Table of contents
|
|
33 |
1. Introduction
|
34 |
===============
|
35 |
|
36 |
-
Thank you for using PageCache powered by Varnish module.
|
37 |
-
contains everything you need to connect Varnish Cache with your
|
38 |
Magento Commerce shop and to get the most out of Varnish’s powerful
|
39 |
caching capabilities for a blazing fast eCommerce site.
|
40 |
|
@@ -44,17 +45,18 @@ PHOENIX MEDIA is a Varnish Integration Partner and Magento Gold Partner
|
|
44 |
in Germany and Austria and is maintaining this module as well as providing
|
45 |
professional services for Varnish and Magento Commerce.
|
46 |
|
47 |
-
The PageCache
|
48 |
-
The Magento module and
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
to
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
58 |
or even flash or PDF resources. While you can also clean Varnish’s
|
59 |
static content cache from the Magento Cache Management page the
|
60 |
PageCache configuration won’t affect any of the static file’s HTTP
|
@@ -75,19 +77,16 @@ Ensure that your Magento Commerce shop is running without any problems
|
|
75 |
in your environment as debugging Magento issues with a proxy like
|
76 |
Varnish in front might be difficult.
|
77 |
|
78 |
-
PageCache
|
79 |
-
|
80 |
-
on.
|
81 |
|
82 |
-
Furthermore you should have installed Varnish >=
|
83 |
server. To install Varnish Cache refer to the excellent documentation at
|
84 |
http://www.varnish-cache.org/docs/ where you will also find lots of
|
85 |
-
information about VCL (Varnish Configuration Language)
|
86 |
-
heart of Varnish.
|
87 |
If you need professional service for setup your server please contact
|
88 |
Varnish Software for commercial support for the Varnish Cache software.
|
89 |
-
Check out their website or send them a mail at
|
90 |
-
sales@varnish-software.com.
|
91 |
|
92 |
|
93 |
3. Installation
|
@@ -96,13 +95,13 @@ sales@varnish-software.com.
|
|
96 |
The installation of the Magento module is pretty easy:
|
97 |
|
98 |
1. Copy the contents of the app directory in the archive to the app
|
99 |
-
directory of your Magento instance.
|
100 |
2. Go to the Magento backend and open the Cache Management (System ->
|
101 |
-
Cache Management) and refresh the configuration and layout cache.
|
102 |
|
103 |
-
If any critical issue occurs you can’t easily solve go to
|
104 |
app/etc/modules, open "Phoenix_VarnishCache.xml" and set "false" in the
|
105 |
-
"active" tag to deactivate the PageCache module
|
106 |
clear Magento’s cache again.
|
107 |
|
108 |
As Varnish is already installed on your server you should just make a
|
@@ -110,7 +109,23 @@ backup of your default.vcl file which is shipped with Varnish. It should
|
|
110 |
be located at /etc/varnish/default.vcl. Copy the VCL file bundled with
|
111 |
the PageCache module for your version of Varnish (located at
|
112 |
app/code/local/Phoenix/VarnishCache/etc/default*.vcl) to your Varnish
|
113 |
-
configuration directory (/etc/varnish/).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
Do not restart the Varnish service until you have checked the new VCL
|
115 |
file to adjust your hosting specific values (at least backends and purge
|
116 |
ACLs).
|
@@ -124,8 +139,8 @@ Proceed with the configuration.
|
|
124 |
4.1 PageCache module
|
125 |
====================
|
126 |
|
127 |
-
In your Magento backend go to System -> Configuration ->
|
128 |
-
|
129 |
|
130 |
In the following section the configuration options for the PageCache
|
131 |
powered by Varnish module are explained. Most of them can be changed on
|
@@ -142,24 +157,25 @@ should be set to "Yes" globally even if you like to deactivate the
|
|
142 |
module for certain websites or store views. Otherwise the cleaning
|
143 |
options on the Cache Magement page won’t be available.
|
144 |
|
|
|
145 |
Varnish servers
|
146 |
---------------
|
147 |
-
Add your Varnish server domains or IPs separated by semicolon.
|
148 |
|
149 |
Server port
|
150 |
-----------
|
151 |
-
The port your Varnish servers
|
152 |
-
in your server list.
|
153 |
|
154 |
Admin Server port
|
155 |
-----------------
|
156 |
-
The port your Varnish servers telnet listens to.
|
157 |
-
in your server list.
|
158 |
|
159 |
Admin server secret
|
160 |
----------------------------
|
161 |
-
Secret string for CLI authentication.
|
162 |
-
in your server list.
|
163 |
|
164 |
Disable caching
|
165 |
---------------
|
@@ -168,6 +184,7 @@ page in Varnish. This is useful for development or tests by passing all
|
|
168 |
requests through Varnish without caching them. If you have a staging
|
169 |
website within your Magento Enterprise instance make sure this option is
|
170 |
set to "Yes" for this website.
|
|
|
171 |
|
172 |
Disable caching for routes
|
173 |
--------------------------
|
@@ -210,11 +227,12 @@ vcl_fetch section of the VCL (Default: set beresp.ttl = 4h).
|
|
210 |
|
211 |
Cache TTL for routes
|
212 |
---------------------
|
213 |
-
This options allows to adjust Varnish cache TTL on per magento
|
214 |
-
controllers/actions basis. To add new TTL value for route
|
215 |
-
"Add route" button
|
216 |
-
|
217 |
-
|
|
|
218 |
|
219 |
Export VCL File
|
220 |
---------------
|
@@ -238,17 +256,14 @@ invalidated each time product update or product's stock update occurs.
|
|
238 |
Additionally, if "Purge Category" option is set to "Yes" this triggers
|
239 |
product's categories cache purge on product/product stock update.
|
240 |
This option is useful to keep product pages and categories up-to-date
|
241 |
-
when product becomes out of stock (e.
|
242 |
a customer).
|
243 |
|
244 |
-
Export VCL
|
245 |
-
----------
|
246 |
-
|
247 |
Purge CMS page
|
248 |
--------------
|
249 |
This option binds automatic purge of CMS page (Varnish) cache with its
|
250 |
update event. If set to "Yes" CMS page cache is invalidated each time
|
251 |
-
CMS page update event occurs (e.
|
252 |
admin).
|
253 |
|
254 |
Debug
|
@@ -263,16 +278,15 @@ this value to "No".
|
|
263 |
Beside the HTTP headers the PageCache module can also log purge requests
|
264 |
to /var/log/varnish_cache.log if the developer log (System ->
|
265 |
Configuration -> Developer) is enabled. The log file will allow you to
|
266 |
-
see which PURGE requests have been sent to
|
267 |
-
|
268 |
|
269 |
4.2 Varnish Cache (VCL)
|
270 |
=======================
|
271 |
|
272 |
-
PageCache
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
http://www.varnish-cache.org/docs/3.0/reference/vcl.html.
|
277 |
|
278 |
When putting Varnish in front of your web server (backend) you will have
|
@@ -297,20 +311,20 @@ Beside the VCL don't forget to check Varnish's startup parameters. They
|
|
297 |
allow fine tuning of timeouts, cache size, location of the VCL file and
|
298 |
much more. Checkout Varnish Cache documentation for details.
|
299 |
|
300 |
-
4.3 PageCache Crawler
|
301 |
-
|
302 |
|
303 |
PageCache Crawler allows to maintain up-to-date store's cache. It runs by
|
304 |
cron making PageCache module generate cache for crawled pages. Therefore,
|
305 |
when a page is visited for the first time its contents delivered from cache
|
306 |
rather than backend.
|
307 |
|
308 |
-
For configuration, in your Magento backend go to System ->
|
309 |
-
|
310 |
|
311 |
Enable Page Cache Auto Generation
|
312 |
---------------------------------
|
313 |
-
Enables the PageCache Crawler module. Please, note that "Cron
|
314 |
Crawler" should contain a valid cron expression, otherwise crawler won't run.
|
315 |
|
316 |
Generate Cache for all Currencies
|
@@ -320,7 +334,7 @@ rather than default currency only.
|
|
320 |
|
321 |
Crawler Thread Number
|
322 |
---------------------
|
323 |
-
The number of requests crawler process runs in parallel.
|
324 |
|
325 |
Cron Expression for Crawler
|
326 |
---------------------------
|
@@ -328,6 +342,77 @@ Defines cron run schedule. This field should contain a valid cron expression
|
|
328 |
string like "0 0 * * *" for daily run or "0 * * * *" for hourly run. For more
|
329 |
information read http://en.wikipedia.org/wiki/Cron
|
330 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
5. Cache cleaning, PURGE requests
|
332 |
=================================
|
333 |
|
@@ -364,11 +449,12 @@ objects that match the appropriate URL path in Varnish. All HTML objects
|
|
364 |
will be purged too as the product image and JavaScript/CSS paths will
|
365 |
change when Magento generated them again so the cached HTML objects
|
366 |
might contain wrong paths if not refreshed.
|
367 |
-
|
368 |
-
|
369 |
If you don’t want these observers to take automatic action comment them
|
370 |
out in the config.xml of the PageCache module.
|
371 |
|
|
|
372 |
6. VCL Design Exceptions
|
373 |
========================
|
374 |
|
@@ -376,17 +462,18 @@ By default Varnish does not take into account User-Agent string of a request
|
|
376 |
when building its cache object. Magento Design Exceptions use regular
|
377 |
expressions to match different design configurations to User-Agent strings.
|
378 |
In order to make Design Exceptions work with Varnish you will have to renew
|
379 |
-
Varnish VCL each time Design Exceptions are updated. Here' what you have to
|
380 |
-
do:
|
381 |
-
|
|
|
|
|
382 |
Your browser should start file download your server VCL updated with design
|
383 |
exceptions subroutine. Restart your varnish servers using downloaded VCL.
|
384 |
|
385 |
You can run "man varnishd" in command line for description of varnishd options.
|
386 |
-
Also see documentation explaining how to start varnish for versions 3.0
|
387 |
-
respectively:
|
388 |
https://www.varnish-cache.org/docs/3.0/tutorial/starting_varnish.html
|
389 |
-
|
390 |
|
391 |
7. Troubleshooting
|
392 |
==================
|
@@ -394,13 +481,19 @@ https://www.varnish-cache.org/docs/2.1/tutorial/starting_varnish.html
|
|
394 |
7.1 Known issues
|
395 |
================
|
396 |
|
397 |
-
- "
|
398 |
-
|
|
|
|
|
|
|
|
|
399 |
- Logging and statistics will be fragmentary (Varnish won't pass cached
|
400 |
requests to the webserver or Magento). Instead make use of a JavaScript
|
401 |
based statistics like Google Analytics or contact Varnish Software who
|
402 |
offers additional tools for that as part of their subscription services.
|
403 |
-
|
|
|
|
|
404 |
|
405 |
7.2 Prevent caching for custom modules
|
406 |
======================================
|
@@ -422,13 +515,12 @@ cookie (compare config.xml):
|
|
422 |
</observers>
|
423 |
</catalog_product_compare_add_product>
|
424 |
|
425 |
-
|
426 |
-
7.3 Prevent caching for HTML/PHP files outsite Magento
|
427 |
======================================================
|
428 |
|
429 |
Varnish as a proxy respects caching information from the backend server like
|
430 |
"Cache-Control: max-age=600" or "Expires: Thu, 19 Nov 2021 08:52:00 GMT".
|
431 |
-
PageCache
|
432 |
page is cacheable and how long.
|
433 |
If you have mod_expires installed in your Apache and the Magento default setting
|
434 |
in your .htaccess 'ExpiresDefault "access plus 1 year"' this will allow Varnish
|
@@ -437,7 +529,7 @@ folder) for one year.
|
|
437 |
However this also affects HTML or PHP files if they don't set their own
|
438 |
"Cache-Control" or "Expires" header. If you don't want HTML contents which don't
|
439 |
explicitly allow caching to be cached by Varnish, add this line to the
|
440 |
-
mod_expires section of your htaccess file:
|
441 |
|
442 |
ExpiresByType text/html A0
|
443 |
|
@@ -447,7 +539,6 @@ will not allow Varnish to cache the object.
|
|
447 |
Note that if a "Expires" header is already set in the HTTP response header
|
448 |
mod_expires will respect it and pass this header without changes.
|
449 |
|
450 |
-
|
451 |
7.4 Debugging requests
|
452 |
======================
|
453 |
|
@@ -460,29 +551,24 @@ browser.
|
|
460 |
A really great help for debugging requests is the "varnishlog" command
|
461 |
that is part of the Varnish distribution. You can call it on the shell
|
462 |
to show only HTML requests:
|
463 |
-
|
464 |
-
varnishlog -c -o TxHeader "Content-Type: text/html" (Varnish 2.1)
|
465 |
|
466 |
Or of a certain URL:
|
467 |
-
|
468 |
-
varnishlog -m RxURL:"^/blog" (Varnish 3.0)
|
469 |
|
470 |
You can also filter the output for a certain client IP:
|
471 |
-
|
472 |
-
varnishlog -c -o ReqStart 123.456.78.9
|
473 |
-
|
474 |
|
475 |
If you still can’t solve the issues please contact
|
476 |
support@phoenix-media.eu to request professional services.
|
477 |
|
478 |
-
|
479 |
7.5 Vary HTTP header for User-Agent
|
480 |
===================================
|
481 |
|
482 |
-
Some administrators
|
483 |
|
484 |
# Make sure proxies don't deliver the wrong content
|
485 |
-
|
486 |
|
487 |
However this forces Varnish Cache to have one cache element per user agent
|
488 |
string for each URL which makes caching almost useless. If you have the
|
@@ -493,9 +579,18 @@ varnishlog and make sure the Vary header only looks like this:
|
|
493 |
Vary: Accept-Encoding
|
494 |
|
495 |
|
496 |
-
|
497 |
============
|
498 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
3.1.1
|
500 |
- Fixed some issues with register_shutdown_function() functionality (introduced in 3.1.0)
|
501 |
|
@@ -526,4 +621,4 @@ varnishlog and make sure the Vary header only looks like this:
|
|
526 |
- Improved hit rate and compatibility for different environments
|
527 |
|
528 |
1.0.0
|
529 |
-
- Initial release
|
1 |
/*******************************************************************************
|
2 |
*
|
3 |
+
* "PageCache powered by Varnish" – Documentation
|
4 |
*
|
5 |
+
* Copyright 2011-2013 by PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
6 |
*
|
7 |
* "VARNISH" is a registered trademark of Varnish Software AB (http://www.varnish-software.com/)
|
8 |
+
* "Magento" is a registered trademark of X.commerce Inc. (http://www.magento.com)
|
9 |
*
|
10 |
******************************************************************************/
|
11 |
|
19 |
4.1 PageCache module
|
20 |
4.2 Varnish Cache (VCL)
|
21 |
4.3 PageCache Crawler
|
22 |
+
4.4 ESI
|
23 |
5. Cache cleaning, PURGE requests
|
24 |
6. VCL Design Exceptions
|
25 |
7. Troubleshooting
|
26 |
7.1 Known issues
|
27 |
7.2 Prevent caching for custom modules
|
28 |
+
7.3 Prevent caching for HTML/PHP files outside Magento
|
29 |
7.4 Debugging requests
|
30 |
7.5 Vary HTTP header for User-Agent
|
31 |
8. Changelog
|
34 |
1. Introduction
|
35 |
===============
|
36 |
|
37 |
+
Thank you for using "PageCache powered by Varnish" (PageCache) module.
|
38 |
+
This package contains everything you need to connect Varnish Cache with your
|
39 |
Magento Commerce shop and to get the most out of Varnish’s powerful
|
40 |
caching capabilities for a blazing fast eCommerce site.
|
41 |
|
45 |
in Germany and Austria and is maintaining this module as well as providing
|
46 |
professional services for Varnish and Magento Commerce.
|
47 |
|
48 |
+
The PageCache module consists of two main components:
|
49 |
+
- The Magento module and
|
50 |
+
- the bundled Varnish Cache configuration file (VCL).
|
51 |
+
The PageCache module basically sets the correct Cache-Control headers
|
52 |
+
according to the configuration and the visitor session and provides
|
53 |
+
an interface for cleaning Varnish’s cache.
|
54 |
+
The second component, the VCL, configures Varnish to process the client requests
|
55 |
+
and Magento’s HTML response according to the Cache-Control headers
|
56 |
+
the PageCache module adds to every response.
|
57 |
+
|
58 |
+
Beside shop pages Varnish will also cache static content that is
|
59 |
+
served by the web server like product images, CSS or JavaScript files
|
60 |
or even flash or PDF resources. While you can also clean Varnish’s
|
61 |
static content cache from the Magento Cache Management page the
|
62 |
PageCache configuration won’t affect any of the static file’s HTTP
|
77 |
in your environment as debugging Magento issues with a proxy like
|
78 |
Varnish in front might be difficult.
|
79 |
|
80 |
+
PageCache supports Magento Community Edition from version 1.5.1
|
81 |
+
and Magento Professional/Enterprise Edition from version 1.9.0 on.
|
|
|
82 |
|
83 |
+
Furthermore you should have installed Varnish >= 3.0 on your Linux
|
84 |
server. To install Varnish Cache refer to the excellent documentation at
|
85 |
http://www.varnish-cache.org/docs/ where you will also find lots of
|
86 |
+
information about VCL (Varnish Configuration Language), the heart of Varnish.
|
|
|
87 |
If you need professional service for setup your server please contact
|
88 |
Varnish Software for commercial support for the Varnish Cache software.
|
89 |
+
Check out their website or send them a mail at sales@varnish-software.com.
|
|
|
90 |
|
91 |
|
92 |
3. Installation
|
95 |
The installation of the Magento module is pretty easy:
|
96 |
|
97 |
1. Copy the contents of the app directory in the archive to the app
|
98 |
+
directory of your Magento instance.
|
99 |
2. Go to the Magento backend and open the Cache Management (System ->
|
100 |
+
Cache Management) and refresh the configuration and layout cache.
|
101 |
|
102 |
+
If any critical issue occurs you can’t easily solve, go to
|
103 |
app/etc/modules, open "Phoenix_VarnishCache.xml" and set "false" in the
|
104 |
+
"active" tag to deactivate the PageCache module. If necessary
|
105 |
clear Magento’s cache again.
|
106 |
|
107 |
As Varnish is already installed on your server you should just make a
|
109 |
be located at /etc/varnish/default.vcl. Copy the VCL file bundled with
|
110 |
the PageCache module for your version of Varnish (located at
|
111 |
app/code/local/Phoenix/VarnishCache/etc/default*.vcl) to your Varnish
|
112 |
+
configuration directory (/etc/varnish/). If you subscribed to the Enterprise Edition
|
113 |
+
of the module you find and improved VCL file with ESI support (see section 4.4) here:
|
114 |
+
app/code/local/Phoenix/VarnishCacheEnterprise/etc/esi_3.0.vcl.
|
115 |
+
|
116 |
+
We also recommend you check Varnish's startup parameters. Depending on your OS the
|
117 |
+
location of your startup settings might differ. For RHEL/CentOS e.g. you find it under
|
118 |
+
/etc/sysconfig/varnish.
|
119 |
+
To make ESI run smoothly add this startup parameters:
|
120 |
+
|
121 |
+
-p esi_syntax=0x1
|
122 |
+
to make varnish not yell at you cause of "no valid XML"
|
123 |
+
|
124 |
+
-p shm_reclen=4096
|
125 |
+
to maximize the length for GET requests - 4K should be fair enough.
|
126 |
+
if this is too short - varnish will truncate your request.
|
127 |
+
|
128 |
+
|
129 |
Do not restart the Varnish service until you have checked the new VCL
|
130 |
file to adjust your hosting specific values (at least backends and purge
|
131 |
ACLs).
|
139 |
4.1 PageCache module
|
140 |
====================
|
141 |
|
142 |
+
In your Magento backend go to System -> Configuration -> "PageCache
|
143 |
+
powered by Varnish Enterprise" and open "General Settings" tab.
|
144 |
|
145 |
In the following section the configuration options for the PageCache
|
146 |
powered by Varnish module are explained. Most of them can be changed on
|
157 |
module for certain websites or store views. Otherwise the cleaning
|
158 |
options on the Cache Magement page won’t be available.
|
159 |
|
160 |
+
|
161 |
Varnish servers
|
162 |
---------------
|
163 |
+
Add your Varnish server(s) domains or IPs separated by semicolon.
|
164 |
|
165 |
Server port
|
166 |
-----------
|
167 |
+
The port your Varnish servers listens on.
|
168 |
+
This port is used for all servers in your server list.
|
169 |
|
170 |
Admin Server port
|
171 |
-----------------
|
172 |
+
The port your Varnish servers telnet listens to.
|
173 |
+
This port is used for all servers in your server list.
|
174 |
|
175 |
Admin server secret
|
176 |
----------------------------
|
177 |
+
Secret string for CLI authentication.
|
178 |
+
This file is used for all servers in your server list.
|
179 |
|
180 |
Disable caching
|
181 |
---------------
|
184 |
requests through Varnish without caching them. If you have a staging
|
185 |
website within your Magento Enterprise instance make sure this option is
|
186 |
set to "Yes" for this website.
|
187 |
+
Technically Varnish will still be active but every request gets a TTL of 0.
|
188 |
|
189 |
Disable caching for routes
|
190 |
--------------------------
|
227 |
|
228 |
Cache TTL for routes
|
229 |
---------------------
|
230 |
+
This options allows you to adjust Varnish cache TTL on a per magento
|
231 |
+
controllers/actions basis. To add a new TTL value for route
|
232 |
+
1) click "Add route" button
|
233 |
+
2) input route (e.g. "cms", "catalog_product_view");
|
234 |
+
3) input TTL for route in seconds (e.g. "7200").
|
235 |
+
"Default Cache TTL" value is used when no TTL for a given route is defined.
|
236 |
|
237 |
Export VCL File
|
238 |
---------------
|
256 |
Additionally, if "Purge Category" option is set to "Yes" this triggers
|
257 |
product's categories cache purge on product/product stock update.
|
258 |
This option is useful to keep product pages and categories up-to-date
|
259 |
+
when product becomes out of stock (i.e. when the last item purchased by
|
260 |
a customer).
|
261 |
|
|
|
|
|
|
|
262 |
Purge CMS page
|
263 |
--------------
|
264 |
This option binds automatic purge of CMS page (Varnish) cache with its
|
265 |
update event. If set to "Yes" CMS page cache is invalidated each time
|
266 |
+
CMS page update event occurs (i.e. CMS page content update via Magento
|
267 |
admin).
|
268 |
|
269 |
Debug
|
278 |
Beside the HTTP headers the PageCache module can also log purge requests
|
279 |
to /var/log/varnish_cache.log if the developer log (System ->
|
280 |
Configuration -> Developer) is enabled. The log file will allow you to
|
281 |
+
see which PURGE requests have been sent to Varnish.
|
|
|
282 |
|
283 |
4.2 Varnish Cache (VCL)
|
284 |
=======================
|
285 |
|
286 |
+
PageCache ships with a ready-to-go VCL file that let Magento and Varnish
|
287 |
+
play nicely together. Although the VCL should be sufficient to start with
|
288 |
+
Magento and Varnish right away you can of course adjust it to your needs
|
289 |
+
if necessary. Please see VCL documentation at
|
290 |
http://www.varnish-cache.org/docs/3.0/reference/vcl.html.
|
291 |
|
292 |
When putting Varnish in front of your web server (backend) you will have
|
311 |
allow fine tuning of timeouts, cache size, location of the VCL file and
|
312 |
much more. Checkout Varnish Cache documentation for details.
|
313 |
|
314 |
+
4.3 PageCache Crawler (Enterprise Edition only)
|
315 |
+
===============================================
|
316 |
|
317 |
PageCache Crawler allows to maintain up-to-date store's cache. It runs by
|
318 |
cron making PageCache module generate cache for crawled pages. Therefore,
|
319 |
when a page is visited for the first time its contents delivered from cache
|
320 |
rather than backend.
|
321 |
|
322 |
+
For configuration, in your Magento backend go to System -> Configuration ->
|
323 |
+
"PageCache powered by Varnish Enterprise" and open the "Crawler Settings" tab.
|
324 |
|
325 |
Enable Page Cache Auto Generation
|
326 |
---------------------------------
|
327 |
+
Enables the PageCache Crawler module. Please, note that "Cron Expression for
|
328 |
Crawler" should contain a valid cron expression, otherwise crawler won't run.
|
329 |
|
330 |
Generate Cache for all Currencies
|
334 |
|
335 |
Crawler Thread Number
|
336 |
---------------------
|
337 |
+
The number of requests the crawler process runs in parallel.
|
338 |
|
339 |
Cron Expression for Crawler
|
340 |
---------------------------
|
342 |
string like "0 0 * * *" for daily run or "0 * * * *" for hourly run. For more
|
343 |
information read http://en.wikipedia.org/wiki/Cron
|
344 |
|
345 |
+
4.4 ESI (Enterprise Edition only)
|
346 |
+
=================================
|
347 |
+
|
348 |
+
Edge Side Includes (ESI) is implemented in Varnish as a subset of the W3C
|
349 |
+
definition (http://www.w3.org/TR/esi-lang) and supports esi:include and
|
350 |
+
esi:remove only.
|
351 |
+
With ESI enabled your Magento installation will become even faster than running
|
352 |
+
only Varnish alone. ESI is used to cache recurring snippets (aka blocks in Magento)
|
353 |
+
and reuse them in different pages.
|
354 |
+
To make ESI play nicely with Magento we provide you with a custom VCL file that
|
355 |
+
is found in app/code/local/Phoenix/VarnishCacheEnterprise/etc/esi_3.0.vcl
|
356 |
+
All basic setup steps for the default.vcl bundled with PageCache apply for the
|
357 |
+
enterprise VCL.
|
358 |
+
Please note that the Page Cache shipped with Magento Enterprise Edition is not
|
359 |
+
compatible with ESI and therefore has to be turned of (System -> Cache Management)
|
360 |
+
as it is based on the same application logic (replacing original blocks with
|
361 |
+
placeholders and compile the actual page content on the fly).
|
362 |
+
|
363 |
+
The enterprise version comes preconfigured with ESI handling for these blocks:
|
364 |
+
- top links
|
365 |
+
- welcome message
|
366 |
+
- sidebar/mini cart
|
367 |
+
- recently viewed products
|
368 |
+
- recently compared products
|
369 |
+
- wishlist
|
370 |
+
|
371 |
+
To enable ESI functionality go to System -> Configuration -> "PageCache powered by
|
372 |
+
Varnish Enterprise" and open the "ESI Settings" tab and choose "Yes" with
|
373 |
+
"Enable ESI".
|
374 |
+
Magento Enterprise users need to make sure that the "Page Cache" in System -> Cache
|
375 |
+
Management is disabled before enabling ESI.
|
376 |
+
|
377 |
+
Default ESI TTL
|
378 |
+
---------------
|
379 |
+
The default TTL for ESI blocks in seconds. This applies for blocks that have no specific
|
380 |
+
value in the next section.
|
381 |
+
|
382 |
+
ESI TTL for blocks
|
383 |
+
------------------
|
384 |
+
You can override the default TTL by setting block specific values.
|
385 |
+
The block name must match the tag names defined in the config.xml in
|
386 |
+
app/code/local/Phoenix/VarnishCacheEnterprise/etc in the <varnishenterprise_esi_tags>
|
387 |
+
section.
|
388 |
+
|
389 |
+
ESI Strict Rendering
|
390 |
+
--------------------
|
391 |
+
When set to ""No"" block logic gets simplified to get better hit rates. However the content might slightly
|
392 |
+
differ from native Magento block. This affects especially to the "recently viewed products" and "recently compared
|
393 |
+
products" block which natively filters the list of viewed or compared products.
|
394 |
+
|
395 |
+
Disable ESI on secure requests
|
396 |
+
------------------------------
|
397 |
+
Secure requests can be problematic as ESI processing with Varnish requires SSL offloading. Leave this option to "yes" to
|
398 |
+
disable ESI blocks for secure requests.
|
399 |
+
If your web server (Apache, NginX) listens on port 443 (HTTPS/SSL) Varnish will not be able to process the ESI tags and
|
400 |
+
the blocks would be empty. If this option is set to "yes" the module will deactivate ESI functionality for secure
|
401 |
+
requests. If you are using SSL offloading (e.g. by a load balancer or NginX infront of the Varnish server) you can set
|
402 |
+
this option to "no".
|
403 |
+
Note that some blocks (e.g. last viewed products) won't work correctly when ESI blocks are disabled on secure requests.
|
404 |
+
|
405 |
+
ESI Debug
|
406 |
+
---------
|
407 |
+
Enables markers to identify ESI blocks in the frontend. It will also echo the internal
|
408 |
+
ESI URL per block for debugging. Use this only in a test environment.
|
409 |
+
|
410 |
+
ESI Passthrough
|
411 |
+
---------------
|
412 |
+
Pass all ESI requests through Varnish to the backend without caching them. This is a shortcut to set the TTL of ESI
|
413 |
+
blocks temporarily to 0 seconds.
|
414 |
+
|
415 |
+
|
416 |
5. Cache cleaning, PURGE requests
|
417 |
=================================
|
418 |
|
449 |
will be purged too as the product image and JavaScript/CSS paths will
|
450 |
change when Magento generated them again so the cached HTML objects
|
451 |
might contain wrong paths if not refreshed.
|
452 |
+
You can also enable automatic purging of CMS pages, categories and products
|
453 |
+
when they are saved (see configuration).
|
454 |
If you don’t want these observers to take automatic action comment them
|
455 |
out in the config.xml of the PageCache module.
|
456 |
|
457 |
+
|
458 |
6. VCL Design Exceptions
|
459 |
========================
|
460 |
|
462 |
when building its cache object. Magento Design Exceptions use regular
|
463 |
expressions to match different design configurations to User-Agent strings.
|
464 |
In order to make Design Exceptions work with Varnish you will have to renew
|
465 |
+
Varnish VCL each time Design Exceptions are updated. Here's what you have to
|
466 |
+
do:
|
467 |
+
In your Magento backend go to System -> Configuration -> "PageCache powered by
|
468 |
+
Varnish Enterprise" and open "General Settings" tab.
|
469 |
+
Press "Export VCL" button.
|
470 |
Your browser should start file download your server VCL updated with design
|
471 |
exceptions subroutine. Restart your varnish servers using downloaded VCL.
|
472 |
|
473 |
You can run "man varnishd" in command line for description of varnishd options.
|
474 |
+
Also see documentation explaining how to start varnish for versions 3.0 respectively:
|
|
|
475 |
https://www.varnish-cache.org/docs/3.0/tutorial/starting_varnish.html
|
476 |
+
|
477 |
|
478 |
7. Troubleshooting
|
479 |
==================
|
481 |
7.1 Known issues
|
482 |
================
|
483 |
|
484 |
+
- "Use SID in Frontend" in System Configuration->Web->Session Validation Settings
|
485 |
+
must not be set to "yes" otherwise a GET parameter ___SID will be added
|
486 |
+
which disables caching at all.
|
487 |
+
- "Redirect to CMS-page if Cookies are Disabled" in System Configuration->Web->
|
488 |
+
Browser Capabilities Detection must be turned off as visitors served by Varnish
|
489 |
+
won't get a cookie until they put something in the cart of login.
|
490 |
- Logging and statistics will be fragmentary (Varnish won't pass cached
|
491 |
requests to the webserver or Magento). Instead make use of a JavaScript
|
492 |
based statistics like Google Analytics or contact Varnish Software who
|
493 |
offers additional tools for that as part of their subscription services.
|
494 |
+
- Running FPC (Magento Enterprise Full Page Cache) along with ESI will result in
|
495 |
+
ESI not displaying any cached blocks. To use Varnish ESI with Magento Enterprise
|
496 |
+
you have to disable FPC completely.
|
497 |
|
498 |
7.2 Prevent caching for custom modules
|
499 |
======================================
|
515 |
</observers>
|
516 |
</catalog_product_compare_add_product>
|
517 |
|
518 |
+
7.3 Prevent caching for HTML/PHP files outside Magento
|
|
|
519 |
======================================================
|
520 |
|
521 |
Varnish as a proxy respects caching information from the backend server like
|
522 |
"Cache-Control: max-age=600" or "Expires: Thu, 19 Nov 2021 08:52:00 GMT".
|
523 |
+
PageCache uses "Expires" to tell Varnish whether a Magento
|
524 |
page is cacheable and how long.
|
525 |
If you have mod_expires installed in your Apache and the Magento default setting
|
526 |
in your .htaccess 'ExpiresDefault "access plus 1 year"' this will allow Varnish
|
529 |
However this also affects HTML or PHP files if they don't set their own
|
530 |
"Cache-Control" or "Expires" header. If you don't want HTML contents which don't
|
531 |
explicitly allow caching to be cached by Varnish, add this line to the
|
532 |
+
mod_expires section of your .htaccess file:
|
533 |
|
534 |
ExpiresByType text/html A0
|
535 |
|
539 |
Note that if a "Expires" header is already set in the HTTP response header
|
540 |
mod_expires will respect it and pass this header without changes.
|
541 |
|
|
|
542 |
7.4 Debugging requests
|
543 |
======================
|
544 |
|
551 |
A really great help for debugging requests is the "varnishlog" command
|
552 |
that is part of the Varnish distribution. You can call it on the shell
|
553 |
to show only HTML requests:
|
554 |
+
varnishlog -c -o TxHeader "Content-Type: text/html" (Varnish 2.1)
|
|
|
555 |
|
556 |
Or of a certain URL:
|
557 |
+
varnishlog -m RxURL:"^/blog" (Varnish 3.0)
|
|
|
558 |
|
559 |
You can also filter the output for a certain client IP:
|
560 |
+
varnishlog -c -o ReqStart 123.456.78.9
|
|
|
|
|
561 |
|
562 |
If you still can’t solve the issues please contact
|
563 |
support@phoenix-media.eu to request professional services.
|
564 |
|
|
|
565 |
7.5 Vary HTTP header for User-Agent
|
566 |
===================================
|
567 |
|
568 |
+
Some administrators have this line in Magento's .htaccess file:
|
569 |
|
570 |
# Make sure proxies don't deliver the wrong content
|
571 |
+
Header append Vary User-Agent env=!dont-vary
|
572 |
|
573 |
However this forces Varnish Cache to have one cache element per user agent
|
574 |
string for each URL which makes caching almost useless. If you have the
|
579 |
Vary: Accept-Encoding
|
580 |
|
581 |
|
582 |
+
8. Changelog
|
583 |
============
|
584 |
|
585 |
+
4.0.0
|
586 |
+
- added store and currency switch support
|
587 |
+
- added advanced message handling
|
588 |
+
- added Varnish ESI support for basic blocks (sidebar/mini cart, top links, welcome message, last viewed and compared products)
|
589 |
+
- raised Magento version requirements to CE 1.5.1 and EE 1.9
|
590 |
+
- dropped support for Varnish 2.x
|
591 |
+
- moved configuration in separate tab
|
592 |
+
- small bugfixes
|
593 |
+
|
594 |
3.1.1
|
595 |
- Fixed some issues with register_shutdown_function() functionality (introduced in 3.1.0)
|
596 |
|
621 |
- Improved hit rate and compatibility for different environments
|
622 |
|
623 |
1.0.0
|
624 |
+
- Initial release
|
app/code/community/Phoenix/VarnishCache/Block/Adminhtml/Cache/Additional.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Block/Adminhtml/System/Config/Fieldset/RouteTTL.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
@@ -40,6 +40,6 @@ class Phoenix_VarnishCache_Block_Adminhtml_System_Config_Fieldset_RouteTTL
|
|
40 |
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
-
return '<div id="
|
44 |
}
|
45 |
}
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
40 |
|
41 |
protected function _toHtml()
|
42 |
{
|
43 |
+
return '<div id="varnishcache_general_routes_ttl">' . parent::_toHtml() . '</div>';
|
44 |
}
|
45 |
}
|
app/code/community/Phoenix/VarnishCache/Block/Adminhtml/System/Config/Fieldset/Versioninfo.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
@@ -30,9 +30,12 @@ class Phoenix_VarnishCache_Block_Adminhtml_System_Config_Fieldset_Versioninfo
|
|
30 |
*/
|
31 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
32 |
{
|
33 |
-
$info = '<fieldset class="config">
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
36 |
|
37 |
return $info;
|
38 |
}
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
30 |
*/
|
31 |
public function render(Varien_Data_Form_Element_Abstract $element)
|
32 |
{
|
33 |
+
$info = '<fieldset class="config">' .
|
34 |
+
Mage::helper('varnishcache')->__(
|
35 |
+
'PageCache powered by Varnish Community version: %s',
|
36 |
+
Mage::getConfig()->getNode('modules/Phoenix_VarnishCache/version')
|
37 |
+
) .
|
38 |
+
'</fieldset>';
|
39 |
|
40 |
return $info;
|
41 |
}
|
app/code/community/Phoenix/VarnishCache/Helper/Cache.php
CHANGED
@@ -14,17 +14,17 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
22 |
{
|
23 |
-
const XML_PATH_VARNISH_CACHE_DISABLE_CACHING = '
|
24 |
-
const XML_PATH_VARNISH_CACHE_DISABLE_CACHING_VARS = '
|
25 |
-
const XML_PATH_VARNISH_CACHE_DISABLE_ROUTES = '
|
26 |
-
const XML_PATH_VARNISH_CACHE_TTL = '
|
27 |
-
const XML_PATH_VARNISH_CACHE_ROUTES_TTL = '
|
28 |
|
29 |
const REGISTRY_VAR_VARNISH_CACHE_CONTROL_HEADERS_SET_FLAG = '_varnish_cache_control_headers_set_flag';
|
30 |
|
@@ -35,6 +35,20 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
35 |
*/
|
36 |
const NO_CACHE_COOKIE = 'EXTERNAL_NO_CACHE';
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
/**
|
39 |
* Header for debug flag
|
40 |
*
|
@@ -54,7 +68,6 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
54 |
return Mage::getSingleton('core/cookie');
|
55 |
}
|
56 |
|
57 |
-
|
58 |
/**
|
59 |
* Set appropriate cache control headers
|
60 |
*
|
@@ -68,13 +81,18 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
68 |
Mage::register(self::REGISTRY_VAR_VARNISH_CACHE_CONTROL_HEADERS_SET_FLAG, 1);
|
69 |
}
|
70 |
|
71 |
-
$request = Mage::app()->getRequest();
|
72 |
-
|
73 |
// set debug header
|
74 |
if (Mage::helper('varnishcache')->isDebug()) {
|
75 |
$this->setDebugHeader();
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
// check for disable caching vars
|
79 |
if ($disableCachingVars = trim(Mage::getStoreConfig(self::XML_PATH_VARNISH_CACHE_DISABLE_CACHING_VARS))) {
|
80 |
foreach (explode(',', $disableCachingVars) as $param) {
|
@@ -150,7 +168,7 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
150 |
public static function sanitizeCacheControlHeader()
|
151 |
{
|
152 |
$cookie = self::getCookie();
|
153 |
-
if ($cookie->get(self::NO_CACHE_COOKIE)) {
|
154 |
self::setNoCacheHeader();
|
155 |
}
|
156 |
}
|
@@ -158,6 +176,7 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
158 |
/**
|
159 |
* Disable caching of this and all future request for this visitor
|
160 |
*
|
|
|
161 |
* @return Phoenix_VarnishCache_Helper_Cache
|
162 |
*/
|
163 |
public function setNoCacheCookie($renewOnly = false)
|
@@ -187,8 +206,12 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
187 |
*/
|
188 |
public function setDebugHeader()
|
189 |
{
|
|
|
|
|
|
|
|
|
190 |
$el = explode(':', self::DEBUG_HEADER, 2);
|
191 |
-
|
192 |
return $this;
|
193 |
}
|
194 |
|
@@ -212,6 +235,9 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
212 |
|
213 |
// retrieve existing "Cache-Control" header
|
214 |
$response = Mage::app()->getResponse();
|
|
|
|
|
|
|
215 |
$headers = $response->getHeaders();
|
216 |
|
217 |
foreach ($headers as $key => $header) {
|
@@ -238,6 +264,8 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
238 |
/**
|
239 |
* Find all domains for store
|
240 |
*
|
|
|
|
|
241 |
* @return string
|
242 |
*/
|
243 |
public function getStoreDomainList($storeId = 0, $seperator = '|')
|
@@ -304,5 +332,66 @@ class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
|
304 |
|
305 |
return $this;
|
306 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
}
|
308 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Cache extends Mage_Core_Helper_Abstract
|
22 |
{
|
23 |
+
const XML_PATH_VARNISH_CACHE_DISABLE_CACHING = 'varnishcache/general/disable_caching';
|
24 |
+
const XML_PATH_VARNISH_CACHE_DISABLE_CACHING_VARS = 'varnishcache/general/disable_caching_vars';
|
25 |
+
const XML_PATH_VARNISH_CACHE_DISABLE_ROUTES = 'varnishcache/general/disable_routes';
|
26 |
+
const XML_PATH_VARNISH_CACHE_TTL = 'varnishcache/general/ttl';
|
27 |
+
const XML_PATH_VARNISH_CACHE_ROUTES_TTL = 'varnishcache/general/routes_ttl';
|
28 |
|
29 |
const REGISTRY_VAR_VARNISH_CACHE_CONTROL_HEADERS_SET_FLAG = '_varnish_cache_control_headers_set_flag';
|
30 |
|
35 |
*/
|
36 |
const NO_CACHE_COOKIE = 'EXTERNAL_NO_CACHE';
|
37 |
|
38 |
+
/**
|
39 |
+
* Cookie name for disabling external caching for messages
|
40 |
+
*
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
const MESSAGE_NO_CACHE_COOKIE = 'MESSAGE_NO_CACHE';
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Cookie name for environment cookie
|
47 |
+
*
|
48 |
+
* @var string
|
49 |
+
*/
|
50 |
+
const ENVIRONMENT_COOKIE = 'PAGECACHE_ENV';
|
51 |
+
|
52 |
/**
|
53 |
* Header for debug flag
|
54 |
*
|
68 |
return Mage::getSingleton('core/cookie');
|
69 |
}
|
70 |
|
|
|
71 |
/**
|
72 |
* Set appropriate cache control headers
|
73 |
*
|
81 |
Mage::register(self::REGISTRY_VAR_VARNISH_CACHE_CONTROL_HEADERS_SET_FLAG, 1);
|
82 |
}
|
83 |
|
|
|
|
|
84 |
// set debug header
|
85 |
if (Mage::helper('varnishcache')->isDebug()) {
|
86 |
$this->setDebugHeader();
|
87 |
}
|
88 |
|
89 |
+
// disable caching of secure pages
|
90 |
+
if (Mage::app()->getStore()->isCurrentlySecure()) {
|
91 |
+
return $this->setNoCacheHeader();
|
92 |
+
}
|
93 |
+
|
94 |
+
$request = Mage::app()->getRequest();
|
95 |
+
|
96 |
// check for disable caching vars
|
97 |
if ($disableCachingVars = trim(Mage::getStoreConfig(self::XML_PATH_VARNISH_CACHE_DISABLE_CACHING_VARS))) {
|
98 |
foreach (explode(',', $disableCachingVars) as $param) {
|
168 |
public static function sanitizeCacheControlHeader()
|
169 |
{
|
170 |
$cookie = self::getCookie();
|
171 |
+
if ($cookie->get(self::NO_CACHE_COOKIE) || $cookie->get(self::MESSAGE_NO_CACHE_COOKIE)) {
|
172 |
self::setNoCacheHeader();
|
173 |
}
|
174 |
}
|
176 |
/**
|
177 |
* Disable caching of this and all future request for this visitor
|
178 |
*
|
179 |
+
* @param bool
|
180 |
* @return Phoenix_VarnishCache_Helper_Cache
|
181 |
*/
|
182 |
public function setNoCacheCookie($renewOnly = false)
|
206 |
*/
|
207 |
public function setDebugHeader()
|
208 |
{
|
209 |
+
$response = Mage::app()->getResponse();
|
210 |
+
if (!$response->canSendHeaders()) {
|
211 |
+
return;
|
212 |
+
}
|
213 |
$el = explode(':', self::DEBUG_HEADER, 2);
|
214 |
+
$response->setHeader($el[0], $el[1], true);
|
215 |
return $this;
|
216 |
}
|
217 |
|
235 |
|
236 |
// retrieve existing "Cache-Control" header
|
237 |
$response = Mage::app()->getResponse();
|
238 |
+
if (!$response->canSendHeaders()) {
|
239 |
+
return;
|
240 |
+
}
|
241 |
$headers = $response->getHeaders();
|
242 |
|
243 |
foreach ($headers as $key => $header) {
|
264 |
/**
|
265 |
* Find all domains for store
|
266 |
*
|
267 |
+
* @param int $storeId
|
268 |
+
* @param string $seperator
|
269 |
* @return string
|
270 |
*/
|
271 |
public function getStoreDomainList($storeId = 0, $seperator = '|')
|
332 |
|
333 |
return $this;
|
334 |
}
|
335 |
+
|
336 |
+
/**
|
337 |
+
* Return "1" if message cookie is set.
|
338 |
+
*
|
339 |
+
* @return null | string
|
340 |
+
*/
|
341 |
+
public function getMessageNoCacheCookie()
|
342 |
+
{
|
343 |
+
return $this->getCookie()->get(self::MESSAGE_NO_CACHE_COOKIE);
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Sets a temporary no-cache-cookie for messages
|
348 |
+
*
|
349 |
+
* @return void;
|
350 |
+
*/
|
351 |
+
public function setMessageNoCacheCookie()
|
352 |
+
{
|
353 |
+
$this->getCookie()->set(self::MESSAGE_NO_CACHE_COOKIE, 1);
|
354 |
+
$this->setNoCacheHeader();
|
355 |
+
}
|
356 |
+
|
357 |
+
/**
|
358 |
+
* Deletes temporary no-cache-cookie for messages
|
359 |
+
*
|
360 |
+
* @return void;
|
361 |
+
*/
|
362 |
+
public function deleteMessageNoCacheCookie()
|
363 |
+
{
|
364 |
+
$this->getCookie()->delete(self::MESSAGE_NO_CACHE_COOKIE);
|
365 |
+
$this->setNoCacheHeader();
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* Set environment cookie as hashed value.
|
370 |
+
*
|
371 |
+
* @param array $env
|
372 |
+
* @return void;
|
373 |
+
*/
|
374 |
+
public function setEnvironmentCookie(Array $env)
|
375 |
+
{
|
376 |
+
$newCookieValue = Mage::helper('core')->encrypt(serialize($env));
|
377 |
+
// environment cookie with the same value already exists do nothing
|
378 |
+
if ($newCookieValue !== $this->getCookie()->get(self::ENVIRONMENT_COOKIE)) {
|
379 |
+
$this->getCookie()->set(self::ENVIRONMENT_COOKIE, $newCookieValue);
|
380 |
+
$this->setNoCacheHeader();
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
/**
|
385 |
+
* Delete environment cookie if present
|
386 |
+
*
|
387 |
+
* @return void;
|
388 |
+
*/
|
389 |
+
public function deleteEnvironmentCookie()
|
390 |
+
{
|
391 |
+
if ($this->getCookie()->get(self::ENVIRONMENT_COOKIE)) {
|
392 |
+
$this->getCookie()->delete(self::ENVIRONMENT_COOKIE);
|
393 |
+
$this->setNoCacheHeader();
|
394 |
+
}
|
395 |
+
}
|
396 |
}
|
397 |
|
app/code/community/Phoenix/VarnishCache/Helper/Control/Catalog/Category.php
CHANGED
@@ -14,13 +14,13 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Control_Catalog_Category extends Phoenix_VarnishCache_Helper_Data
|
22 |
{
|
23 |
-
const XML_PATH_VARNISH_CACHE_PURGE = '
|
24 |
|
25 |
/**
|
26 |
* Returns true if Varnish cache is enabled and category should be purged on save
|
@@ -41,4 +41,4 @@ class Phoenix_VarnishCache_Helper_Control_Catalog_Category extends Phoenix_Varni
|
|
41 |
{
|
42 |
return Mage::getStoreConfigFlag(self::XML_PATH_VARNISH_CACHE_PURGE);
|
43 |
}
|
44 |
-
}
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Control_Catalog_Category extends Phoenix_VarnishCache_Helper_Data
|
22 |
{
|
23 |
+
const XML_PATH_VARNISH_CACHE_PURGE = 'varnishcache/general/purge_catalog_category';
|
24 |
|
25 |
/**
|
26 |
* Returns true if Varnish cache is enabled and category should be purged on save
|
41 |
{
|
42 |
return Mage::getStoreConfigFlag(self::XML_PATH_VARNISH_CACHE_PURGE);
|
43 |
}
|
44 |
+
}
|
app/code/community/Phoenix/VarnishCache/Helper/Control/Catalog/Product.php
CHANGED
@@ -14,13 +14,13 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Control_Catalog_Product extends Phoenix_VarnishCache_Helper_Data
|
22 |
{
|
23 |
-
const XML_PATH_VARNISH_CACHE_PURGE = '
|
24 |
|
25 |
/**
|
26 |
* Returns true if Varnish cache is enabled and product should be purged on save
|
@@ -41,4 +41,4 @@ class Phoenix_VarnishCache_Helper_Control_Catalog_Product extends Phoenix_Varnis
|
|
41 |
{
|
42 |
return Mage::getStoreConfigFlag(self::XML_PATH_VARNISH_CACHE_PURGE);
|
43 |
}
|
44 |
-
}
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Control_Catalog_Product extends Phoenix_VarnishCache_Helper_Data
|
22 |
{
|
23 |
+
const XML_PATH_VARNISH_CACHE_PURGE = 'varnishcache/general/purge_catalog_product';
|
24 |
|
25 |
/**
|
26 |
* Returns true if Varnish cache is enabled and product should be purged on save
|
41 |
{
|
42 |
return Mage::getStoreConfigFlag(self::XML_PATH_VARNISH_CACHE_PURGE);
|
43 |
}
|
44 |
+
}
|
app/code/community/Phoenix/VarnishCache/Helper/Control/Cms/Page.php
CHANGED
@@ -14,13 +14,13 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Control_Cms_Page extends Phoenix_VarnishCache_Helper_Data
|
22 |
{
|
23 |
-
const XML_PATH_VARNISH_CACHE_PURGE = '
|
24 |
|
25 |
/**
|
26 |
* Returns true if Varnish cache is enabled and category should be purged on save
|
@@ -41,4 +41,4 @@ class Phoenix_VarnishCache_Helper_Control_Cms_Page extends Phoenix_VarnishCache_
|
|
41 |
{
|
42 |
return Mage::getStoreConfigFlag(self::XML_PATH_VARNISH_CACHE_PURGE);
|
43 |
}
|
44 |
-
}
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Control_Cms_Page extends Phoenix_VarnishCache_Helper_Data
|
22 |
{
|
23 |
+
const XML_PATH_VARNISH_CACHE_PURGE = 'varnishcache/general/purge_cms_page';
|
24 |
|
25 |
/**
|
26 |
* Returns true if Varnish cache is enabled and category should be purged on save
|
41 |
{
|
42 |
return Mage::getStoreConfigFlag(self::XML_PATH_VARNISH_CACHE_PURGE);
|
43 |
}
|
44 |
+
}
|
app/code/community/Phoenix/VarnishCache/Helper/Data.php
CHANGED
@@ -14,14 +14,14 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Data extends Mage_Core_Helper_Abstract
|
22 |
{
|
23 |
-
const XML_PATH_VARNISH_CACHE_ENABLED = '
|
24 |
-
const XML_PATH_VARNISH_CACHE_DEBUG = '
|
25 |
|
26 |
/**
|
27 |
* Check whether Varnish cache is enabled
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Helper_Data extends Mage_Core_Helper_Abstract
|
22 |
{
|
23 |
+
const XML_PATH_VARNISH_CACHE_ENABLED = 'varnishcache/general/enabled';
|
24 |
+
const XML_PATH_VARNISH_CACHE_DEBUG = 'varnishcache/general/debug';
|
25 |
|
26 |
/**
|
27 |
* Check whether Varnish cache is enabled
|
app/code/community/Phoenix/VarnishCache/Model/Catalog/Category/Product.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Catalog/Product/Relation.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
class Phoenix_VarnishCache_Model_Catalog_Product_Relation extends Mage_Core_Model_Abstract
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
class Phoenix_VarnishCache_Model_Catalog_Product_Relation extends Mage_Core_Model_Abstract
|
app/code/community/Phoenix/VarnishCache/Model/Cms/Page/Store.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Control.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
@@ -26,8 +26,8 @@
|
|
26 |
*/
|
27 |
class Phoenix_VarnishCache_Model_Control
|
28 |
{
|
29 |
-
const XML_PATH_VARNISH_SERVERS = '
|
30 |
-
const XML_PATH_VARNISH_PORT = '
|
31 |
|
32 |
const CONTENT_TYPE_HTML = 'text/html';
|
33 |
const CONTENT_TYPE_CSS = 'text/css';
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
26 |
*/
|
27 |
class Phoenix_VarnishCache_Model_Control
|
28 |
{
|
29 |
+
const XML_PATH_VARNISH_SERVERS = 'varnishcache/general/servers';
|
30 |
+
const XML_PATH_VARNISH_PORT = 'varnishcache/general/port';
|
31 |
|
32 |
const CONTENT_TYPE_HTML = 'text/html';
|
33 |
const CONTENT_TYPE_CSS = 'text/css';
|
app/code/community/Phoenix/VarnishCache/Model/Control/Abstract.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Control/Catalog/Category.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Control/Catalog/Product.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Control/Cms/Page.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Observer.php
CHANGED
@@ -14,13 +14,20 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Model_Observer
|
22 |
{
|
23 |
const SET_CACHE_HEADER_FLAG = 'VARNISH_CACHE_CONTROL_HEADERS_SET';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
/**
|
26 |
* Retrieve session model
|
@@ -52,6 +59,19 @@ class Phoenix_VarnishCache_Model_Observer
|
|
52 |
return Mage::getSingleton('varnishcache/control');
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
/**
|
56 |
* Clean all Varnish cache items
|
57 |
*
|
@@ -61,7 +81,7 @@ class Phoenix_VarnishCache_Model_Observer
|
|
61 |
public function cleanCache(Varien_Event_Observer $observer)
|
62 |
{
|
63 |
if ($this->_isCacheEnabled()) {
|
64 |
-
$this->_getCacheControl()->clean(
|
65 |
|
66 |
$this->_getSession()->addSuccess(
|
67 |
Mage::helper('varnishcache')->__('The Varnish cache has been cleaned.')
|
@@ -80,13 +100,13 @@ class Phoenix_VarnishCache_Model_Observer
|
|
80 |
{
|
81 |
if ($this->_isCacheEnabled()) {
|
82 |
$this->_getCacheControl()->clean(
|
83 |
-
|
84 |
'^/media/(js|css|css_secure)/'
|
85 |
);
|
86 |
|
87 |
// also clean HTML files
|
88 |
$this->_getCacheControl()->clean(
|
89 |
-
|
90 |
'.*',
|
91 |
Phoenix_VarnishCache_Model_Control::CONTENT_TYPE_HTML
|
92 |
);
|
@@ -108,14 +128,14 @@ class Phoenix_VarnishCache_Model_Observer
|
|
108 |
{
|
109 |
if ($this->_isCacheEnabled()) {
|
110 |
$this->_getCacheControl()->clean(
|
111 |
-
|
112 |
'^/media/catalog/product/cache/',
|
113 |
Phoenix_VarnishCache_Model_Control::CONTENT_TYPE_IMAGE
|
114 |
);
|
115 |
|
116 |
// also clean HTML files
|
117 |
$this->_getCacheControl()->clean(
|
118 |
-
|
119 |
'.*',
|
120 |
Phoenix_VarnishCache_Model_Control::CONTENT_TYPE_HTML
|
121 |
);
|
@@ -127,63 +147,6 @@ class Phoenix_VarnishCache_Model_Observer
|
|
127 |
return $this;
|
128 |
}
|
129 |
|
130 |
-
/**
|
131 |
-
* Set appropriate cache control headers
|
132 |
-
*
|
133 |
-
* @param Varien_Event_Observer $observer
|
134 |
-
* @return Phoenix_VarnishCache_Model_Observer
|
135 |
-
*/
|
136 |
-
public function setCacheControlHeaders(Varien_Event_Observer $observer)
|
137 |
-
{
|
138 |
-
if ($this->_isCacheEnabled()) {
|
139 |
-
if (!Mage::registry(self::SET_CACHE_HEADER_FLAG)) {
|
140 |
-
Mage::helper('varnishcache/cache')->setCacheControlHeaders();
|
141 |
-
Mage::register(self::SET_CACHE_HEADER_FLAG, true);
|
142 |
-
}
|
143 |
-
}
|
144 |
-
return $this;
|
145 |
-
}
|
146 |
-
|
147 |
-
/**
|
148 |
-
* If the page has been cached by the FPC and a NO_CACHE cookie has
|
149 |
-
* been set, the cached Cache-Control header might allow caching of the
|
150 |
-
* page while the NO_CACHE cookie which should prevent it.
|
151 |
-
* To sanitize this conflict we will force a TTL=0 before sending out
|
152 |
-
* the page.
|
153 |
-
*/
|
154 |
-
public function sanitizeCacheControlHeader()
|
155 |
-
{
|
156 |
-
Mage::helper('varnishcache/cache')->sanitizeCacheControlHeader();
|
157 |
-
}
|
158 |
-
|
159 |
-
/**
|
160 |
-
* Disable page caching by setting no-cache header
|
161 |
-
*
|
162 |
-
* @param Varien_Event_Observer $observer | null
|
163 |
-
* @return Mage_PageCache_Model_Observer
|
164 |
-
*/
|
165 |
-
public function disablePageCaching($observer = null)
|
166 |
-
{
|
167 |
-
if ($this->_isCacheEnabled() || Mage::app()->getStore()->isAdmin()) {
|
168 |
-
Mage::helper('varnishcache/cache')->setNoCacheHeader();
|
169 |
-
}
|
170 |
-
return $this;
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Disable page caching for visitor by setting no-cache cookie
|
175 |
-
*
|
176 |
-
* @param Varien_Event_Observer $observer
|
177 |
-
* @return Mage_PageCache_Model_Observer
|
178 |
-
*/
|
179 |
-
public function disablePageCachingPermanent($observer = null)
|
180 |
-
{
|
181 |
-
if ($this->_isCacheEnabled()) {
|
182 |
-
Mage::helper('varnishcache/cache')->setNoCacheCookie();
|
183 |
-
}
|
184 |
-
return $this;
|
185 |
-
}
|
186 |
-
|
187 |
/**
|
188 |
* Purge category
|
189 |
*
|
@@ -266,7 +229,85 @@ class Phoenix_VarnishCache_Model_Observer
|
|
266 |
}
|
267 |
|
268 |
/**
|
269 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
*
|
271 |
* @return Phoenix_VarnishCache_Model_Observer
|
272 |
*/
|
@@ -281,7 +322,7 @@ class Phoenix_VarnishCache_Model_Observer
|
|
281 |
unset($exception);
|
282 |
|
283 |
// register shutdown method
|
284 |
-
register_shutdown_function(array(
|
285 |
}
|
286 |
return $this;
|
287 |
}
|
@@ -296,7 +337,9 @@ class Phoenix_VarnishCache_Model_Observer
|
|
296 |
{
|
297 |
try {
|
298 |
Mage::getSingleton('core/session')->addNotice(
|
299 |
-
Mage::helper('varnishcache')->__(
|
|
|
|
|
300 |
);
|
301 |
|
302 |
$designExceptionSubSnippet = Mage::getSingleton('varnishcacheenterprise/vcl')
|
@@ -314,4 +357,43 @@ class Phoenix_VarnishCache_Model_Observer
|
|
314 |
|
315 |
return $this;
|
316 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
}
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
class Phoenix_VarnishCache_Model_Observer
|
22 |
{
|
23 |
const SET_CACHE_HEADER_FLAG = 'VARNISH_CACHE_CONTROL_HEADERS_SET';
|
24 |
+
const MESSAGE_ADDED_FLAG = 'VARNISH_CACHE_MESSAGE_ADDED_FLAG';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var Phoenix_VarnishCache_Helper_Cache
|
28 |
+
*/
|
29 |
+
protected $_cacheHelper = null;
|
30 |
+
|
31 |
|
32 |
/**
|
33 |
* Retrieve session model
|
59 |
return Mage::getSingleton('varnishcache/control');
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* Return cache helper
|
64 |
+
*
|
65 |
+
* @return Phoenix_VarnishCache_Helper_Cache
|
66 |
+
*/
|
67 |
+
protected function _getCacheHelper()
|
68 |
+
{
|
69 |
+
if (is_null($this->_cacheHelper)) {
|
70 |
+
$this->_cacheHelper = Mage::helper('varnishcache/cache');
|
71 |
+
}
|
72 |
+
return $this->_cacheHelper;
|
73 |
+
}
|
74 |
+
|
75 |
/**
|
76 |
* Clean all Varnish cache items
|
77 |
*
|
81 |
public function cleanCache(Varien_Event_Observer $observer)
|
82 |
{
|
83 |
if ($this->_isCacheEnabled()) {
|
84 |
+
$this->_getCacheControl()->clean($this->_getCacheHelper()->getStoreDomainList());
|
85 |
|
86 |
$this->_getSession()->addSuccess(
|
87 |
Mage::helper('varnishcache')->__('The Varnish cache has been cleaned.')
|
100 |
{
|
101 |
if ($this->_isCacheEnabled()) {
|
102 |
$this->_getCacheControl()->clean(
|
103 |
+
$this->_getCacheHelper()->getStoreDomainList(),
|
104 |
'^/media/(js|css|css_secure)/'
|
105 |
);
|
106 |
|
107 |
// also clean HTML files
|
108 |
$this->_getCacheControl()->clean(
|
109 |
+
$this->_getCacheHelper()->getStoreDomainList(),
|
110 |
'.*',
|
111 |
Phoenix_VarnishCache_Model_Control::CONTENT_TYPE_HTML
|
112 |
);
|
128 |
{
|
129 |
if ($this->_isCacheEnabled()) {
|
130 |
$this->_getCacheControl()->clean(
|
131 |
+
$this->_getCacheHelper()->getStoreDomainList(),
|
132 |
'^/media/catalog/product/cache/',
|
133 |
Phoenix_VarnishCache_Model_Control::CONTENT_TYPE_IMAGE
|
134 |
);
|
135 |
|
136 |
// also clean HTML files
|
137 |
$this->_getCacheControl()->clean(
|
138 |
+
$this->_getCacheHelper()->getStoreDomainList(),
|
139 |
'.*',
|
140 |
Phoenix_VarnishCache_Model_Control::CONTENT_TYPE_HTML
|
141 |
);
|
147 |
return $this;
|
148 |
}
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
/**
|
151 |
* Purge category
|
152 |
*
|
229 |
}
|
230 |
|
231 |
/**
|
232 |
+
* Set appropriate cache control headers
|
233 |
+
*
|
234 |
+
* @param Varien_Event_Observer $observer
|
235 |
+
* @return Phoenix_VarnishCache_Model_Observer
|
236 |
+
*/
|
237 |
+
public function setCacheControlHeaders(Varien_Event_Observer $observer)
|
238 |
+
{
|
239 |
+
if ($this->_isCacheEnabled()) {
|
240 |
+
if (!Mage::registry(self::SET_CACHE_HEADER_FLAG)) {
|
241 |
+
$this->_getCacheHelper()->setCacheControlHeaders();
|
242 |
+
|
243 |
+
/** set environment cookie if current env differs from default */
|
244 |
+
$defaultStore = Mage::app()->getDefaultStoreView();
|
245 |
+
$defaultSettings = array(
|
246 |
+
'storeId' => $defaultStore->getId(),
|
247 |
+
'currency' => $defaultStore->getDefaultCurrencyCode(),
|
248 |
+
'customerGroup' => Mage_Customer_Model_Group::NOT_LOGGED_IN_ID
|
249 |
+
);
|
250 |
+
$currentSettings = array(
|
251 |
+
'storeId' => Mage::app()->getStore()->getId(),
|
252 |
+
'currency' => Mage::app()->getStore()->getCurrentCurrencyCode(),
|
253 |
+
'customerGroup' => Mage::getSingleton('customer/session')->getCustomerGroupId()
|
254 |
+
);
|
255 |
+
|
256 |
+
// only set cookie if not in default
|
257 |
+
if (array_diff($defaultSettings, $currentSettings)) {
|
258 |
+
$this->_getCacheHelper()->setEnvironmentCookie($currentSettings);
|
259 |
+
} else {
|
260 |
+
$this->_getCacheHelper()->deleteEnvironmentCookie();
|
261 |
+
}
|
262 |
+
|
263 |
+
Mage::register(self::SET_CACHE_HEADER_FLAG, true);
|
264 |
+
}
|
265 |
+
}
|
266 |
+
return $this;
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* If the page has been cached by the FPC and a NO_CACHE cookie has
|
271 |
+
* been set, the cached Cache-Control header might allow caching of the
|
272 |
+
* page while the NO_CACHE cookie which should prevent it.
|
273 |
+
* To sanitize this conflict we will force a TTL=0 before sending out
|
274 |
+
* the page.
|
275 |
+
*/
|
276 |
+
public function sanitizeCacheControlHeader()
|
277 |
+
{
|
278 |
+
$this->_getCacheHelper()->sanitizeCacheControlHeader();
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Disable page caching by setting no-cache header
|
283 |
+
*
|
284 |
+
* @param Varien_Event_Observer $observer | null
|
285 |
+
* @return Mage_PageCache_Model_Observer
|
286 |
+
*/
|
287 |
+
public function disablePageCaching($observer = null)
|
288 |
+
{
|
289 |
+
if ($this->_isCacheEnabled() || Mage::app()->getStore()->isAdmin()) {
|
290 |
+
$this->_getCacheHelper()->setNoCacheHeader();
|
291 |
+
}
|
292 |
+
return $this;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Disable page caching for visitor by setting no-cache cookie
|
297 |
+
*
|
298 |
+
* @param Varien_Event_Observer $observer
|
299 |
+
* @return Mage_PageCache_Model_Observer
|
300 |
+
*/
|
301 |
+
public function disablePageCachingPermanent($observer = null)
|
302 |
+
{
|
303 |
+
if ($this->_isCacheEnabled()) {
|
304 |
+
$this->_getCacheHelper()->setNoCacheCookie();
|
305 |
+
}
|
306 |
+
return $this;
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Sets shutdown listener to ensure cache control headers sent in case script exits unexpectedly
|
311 |
*
|
312 |
* @return Phoenix_VarnishCache_Model_Observer
|
313 |
*/
|
322 |
unset($exception);
|
323 |
|
324 |
// register shutdown method
|
325 |
+
register_shutdown_function(array($this->_getCacheHelper(), 'setCacheControlHeadersRaw'));
|
326 |
}
|
327 |
return $this;
|
328 |
}
|
337 |
{
|
338 |
try {
|
339 |
Mage::getSingleton('core/session')->addNotice(
|
340 |
+
Mage::helper('varnishcache')->__(
|
341 |
+
'Update Varnish VCL with design exceptions by using the following snippet:'
|
342 |
+
)
|
343 |
);
|
344 |
|
345 |
$designExceptionSubSnippet = Mage::getSingleton('varnishcacheenterprise/vcl')
|
357 |
|
358 |
return $this;
|
359 |
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Set no-cache cookie for messages if messages have not been cleared before shutdown.
|
363 |
+
*
|
364 |
+
* @param Varien_Event_Observer $observer
|
365 |
+
*/
|
366 |
+
public function handleMessageCookie(Varien_Event_Observer $observer)
|
367 |
+
{
|
368 |
+
if ($this->_isCacheEnabled()) {
|
369 |
+
/**
|
370 |
+
* the following lines are not "lege artis" but very efficient if assumed that the session structure for
|
371 |
+
* messages are designed in "Magento style". that is each session object has its namespace in $_SESSION with
|
372 |
+
* the property "messages" which is an instance of Mage_Core_Model_Message_Collection that holds all
|
373 |
+
* messages for the session object. If the count of message items is > 0 before shutdown a message-no-cache
|
374 |
+
* cookie should be set to keep Varnish from serving cached pages until the messages have been cleared
|
375 |
+
* again. if no messages are in the session objects but a message-no-cache cookie has been send in the
|
376 |
+
* request the messages have been cleared now and the message-no-cache cookie can be removed again, to allow
|
377 |
+
* Varnish to serve cached pages for the next request.
|
378 |
+
*/
|
379 |
+
$cntMessagesInSession = 0;
|
380 |
+
if (isset($_SESSION)) {
|
381 |
+
foreach ($_SESSION as $sessionData) {
|
382 |
+
if (isset($sessionData['messages']) &&
|
383 |
+
$sessionData['messages'] instanceof Mage_Core_Model_Message_Collection) {
|
384 |
+
$cntMessagesInSession += $sessionData['messages']->count();
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
388 |
+
|
389 |
+
if ($cntMessagesInSession > 0) {
|
390 |
+
$this->_getCacheHelper()->setMessageNoCacheCookie();
|
391 |
+
} else {
|
392 |
+
// remove message no-cache cookie for non ESI requests if no messages are left in session
|
393 |
+
if ((Mage::registry('ESI_PROCESSING') === null) && $this->_getCacheHelper()->getMessageNoCacheCookie()) {
|
394 |
+
$this->_getCacheHelper()->deleteMessageNoCacheCookie();
|
395 |
+
}
|
396 |
+
}
|
397 |
+
}
|
398 |
+
}
|
399 |
}
|
app/code/community/Phoenix/VarnishCache/Model/Processor.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Category/Product.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Category/Product/Collection.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Catalog/Product/Relation/Collection.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Cms/Page/Store.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Cms/Page/Store/Collection.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/Model/Resource/Mysql4/Core/Url/Rewrite/Collection.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/controllers/Adminhtml/VarnishCacheController.php
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
app/code/community/Phoenix/VarnishCache/etc/config.xml
CHANGED
@@ -15,14 +15,14 @@
|
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
22 |
<config>
|
23 |
<modules>
|
24 |
<Phoenix_VarnishCache>
|
25 |
-
<version>
|
26 |
</Phoenix_VarnishCache>
|
27 |
</modules>
|
28 |
<global>
|
@@ -45,8 +45,16 @@
|
|
45 |
<class>Phoenix_VarnishCache_Block</class>
|
46 |
</varnishcache>
|
47 |
</blocks>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
<events>
|
49 |
-
<!-- purge product cache after stock
|
50 |
<cataloginventory_stock_item_save_after>
|
51 |
<observers>
|
52 |
<phoenix_varnishcache>
|
@@ -95,6 +103,25 @@
|
|
95 |
</Phoenix_VarnishCache>
|
96 |
</modules>
|
97 |
</translate>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
<events>
|
99 |
<!-- disable page caching for all admin requests -->
|
100 |
<controller_action_predispatch_adminhtml>
|
@@ -203,18 +230,22 @@
|
|
203 |
<class>varnishcache/observer</class>
|
204 |
<method>sanitizeCacheControlHeader</method>
|
205 |
</varnishcache>
|
|
|
|
|
|
|
|
|
206 |
</observers>
|
207 |
</http_response_send_before>
|
208 |
-
|
209 |
-
<!-- stop page caching at visitor interaction -->
|
210 |
<core_session_abstract_add_message>
|
211 |
<observers>
|
212 |
<varnishcache>
|
213 |
<class>varnishcache/observer</class>
|
214 |
-
<method>
|
215 |
</varnishcache>
|
216 |
</observers>
|
217 |
</core_session_abstract_add_message>
|
|
|
|
|
218 |
<checkout_cart_product_add_after>
|
219 |
<observers>
|
220 |
<varnishcache>
|
@@ -250,26 +281,26 @@
|
|
250 |
</events>
|
251 |
</frontend>
|
252 |
<default>
|
253 |
-
<
|
254 |
-
<
|
255 |
<enabled>0</enabled>
|
256 |
<servers>localhost</servers>
|
257 |
<port>80</port>
|
258 |
<disable_caching>0</disable_caching>
|
259 |
-
<disable_routes
|
260 |
-
<![CDATA[checkout
|
261 |
customer
|
262 |
moneybookers
|
263 |
paypal
|
264 |
-
wishlist
|
265 |
-
|
|
|
266 |
<ttl>14400</ttl>
|
267 |
<routes_ttl>a:3:{s:1:"1";a:2:{s:6:"regexp";s:3:"cms";s:5:"value";s:5:"86400";}s:1:"2";a:2:{s:6:"regexp";s:20:"catalog_product_view";s:5:"value";s:4:"7200";}s:1:"3";a:2:{s:6:"regexp";s:16:"catalog_category";s:5:"value";s:5:"21600";}}</routes_ttl>
|
268 |
<purge_catalog_category>0</purge_catalog_category>
|
269 |
<purge_catalog_product>0</purge_catalog_product>
|
270 |
<purge_cms_page>0</purge_cms_page>
|
271 |
<debug>0</debug>
|
272 |
-
</
|
273 |
-
</
|
274 |
</default>
|
275 |
</config>
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
22 |
<config>
|
23 |
<modules>
|
24 |
<Phoenix_VarnishCache>
|
25 |
+
<version>4.0.0</version>
|
26 |
</Phoenix_VarnishCache>
|
27 |
</modules>
|
28 |
<global>
|
45 |
<class>Phoenix_VarnishCache_Block</class>
|
46 |
</varnishcache>
|
47 |
</blocks>
|
48 |
+
<resources>
|
49 |
+
<varnishcache_setup>
|
50 |
+
<setup>
|
51 |
+
<module>Phoenix_VarnishCache</module>
|
52 |
+
<class>Mage_Core_Model_Resource_Setup</class>
|
53 |
+
</setup>
|
54 |
+
</varnishcache_setup>
|
55 |
+
</resources>
|
56 |
<events>
|
57 |
+
<!-- purge product cache after stock update -->
|
58 |
<cataloginventory_stock_item_save_after>
|
59 |
<observers>
|
60 |
<phoenix_varnishcache>
|
103 |
</Phoenix_VarnishCache>
|
104 |
</modules>
|
105 |
</translate>
|
106 |
+
<acl>
|
107 |
+
<resources>
|
108 |
+
<admin>
|
109 |
+
<children>
|
110 |
+
<system>
|
111 |
+
<children>
|
112 |
+
<config>
|
113 |
+
<children>
|
114 |
+
<varnishcache>
|
115 |
+
<title>PageCache powered by Varnish Settings</title>
|
116 |
+
</varnishcache>
|
117 |
+
</children>
|
118 |
+
</config>
|
119 |
+
</children>
|
120 |
+
</system>
|
121 |
+
</children>
|
122 |
+
</admin>
|
123 |
+
</resources>
|
124 |
+
</acl>
|
125 |
<events>
|
126 |
<!-- disable page caching for all admin requests -->
|
127 |
<controller_action_predispatch_adminhtml>
|
230 |
<class>varnishcache/observer</class>
|
231 |
<method>sanitizeCacheControlHeader</method>
|
232 |
</varnishcache>
|
233 |
+
<varnishcache_handle_message_cookie>
|
234 |
+
<class>varnishcache/observer</class>
|
235 |
+
<method>handleMessageCookie</method>
|
236 |
+
</varnishcache_handle_message_cookie>
|
237 |
</observers>
|
238 |
</http_response_send_before>
|
|
|
|
|
239 |
<core_session_abstract_add_message>
|
240 |
<observers>
|
241 |
<varnishcache>
|
242 |
<class>varnishcache/observer</class>
|
243 |
+
<method>disablePageCaching</method>
|
244 |
</varnishcache>
|
245 |
</observers>
|
246 |
</core_session_abstract_add_message>
|
247 |
+
|
248 |
+
<!-- stop page caching at visitor interaction -->
|
249 |
<checkout_cart_product_add_after>
|
250 |
<observers>
|
251 |
<varnishcache>
|
281 |
</events>
|
282 |
</frontend>
|
283 |
<default>
|
284 |
+
<varnishcache>
|
285 |
+
<general>
|
286 |
<enabled>0</enabled>
|
287 |
<servers>localhost</servers>
|
288 |
<port>80</port>
|
289 |
<disable_caching>0</disable_caching>
|
290 |
+
<disable_routes><![CDATA[checkout
|
|
|
291 |
customer
|
292 |
moneybookers
|
293 |
paypal
|
294 |
+
wishlist
|
295 |
+
catalog_product_compare]]></disable_routes>
|
296 |
+
<disable_caching_vars><![CDATA[___SID,order]]></disable_caching_vars>
|
297 |
<ttl>14400</ttl>
|
298 |
<routes_ttl>a:3:{s:1:"1";a:2:{s:6:"regexp";s:3:"cms";s:5:"value";s:5:"86400";}s:1:"2";a:2:{s:6:"regexp";s:20:"catalog_product_view";s:5:"value";s:4:"7200";}s:1:"3";a:2:{s:6:"regexp";s:16:"catalog_category";s:5:"value";s:5:"21600";}}</routes_ttl>
|
299 |
<purge_catalog_category>0</purge_catalog_category>
|
300 |
<purge_catalog_product>0</purge_catalog_product>
|
301 |
<purge_cms_page>0</purge_cms_page>
|
302 |
<debug>0</debug>
|
303 |
+
</general>
|
304 |
+
</varnishcache>
|
305 |
</default>
|
306 |
</config>
|
app/code/community/Phoenix/VarnishCache/etc/default_2.1.vcl
DELETED
@@ -1,241 +0,0 @@
|
|
1 |
-
# This is a basic VCL configuration file for PageCache powered by Varnish for Magento module.
|
2 |
-
|
3 |
-
# default backend definition. Set this to point to your content server.
|
4 |
-
backend default {
|
5 |
-
.host = "127.0.0.1";
|
6 |
-
.port = "8080";
|
7 |
-
}
|
8 |
-
|
9 |
-
# admin backend with longer timeout values. Set this to the same IP & port as your default server.
|
10 |
-
backend admin {
|
11 |
-
.host = "127.0.0.1";
|
12 |
-
.port = "8080";
|
13 |
-
.first_byte_timeout = 18000s;
|
14 |
-
.between_bytes_timeout = 18000s;
|
15 |
-
}
|
16 |
-
|
17 |
-
|
18 |
-
# add your Magento server IP to allow purges from the backend
|
19 |
-
acl purge {
|
20 |
-
"localhost";
|
21 |
-
"127.0.0.1";
|
22 |
-
}
|
23 |
-
|
24 |
-
|
25 |
-
sub vcl_recv {
|
26 |
-
if (req.restarts == 0) {
|
27 |
-
if (req.http.x-forwarded-for) {
|
28 |
-
set req.http.X-Forwarded-For =
|
29 |
-
req.http.X-Forwarded-For ", " client.ip;
|
30 |
-
} else {
|
31 |
-
set req.http.X-Forwarded-For = client.ip;
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
if (req.request != "GET" &&
|
36 |
-
req.request != "HEAD" &&
|
37 |
-
req.request != "PUT" &&
|
38 |
-
req.request != "POST" &&
|
39 |
-
req.request != "TRACE" &&
|
40 |
-
req.request != "OPTIONS" &&
|
41 |
-
req.request != "DELETE" &&
|
42 |
-
req.request != "PURGE") {
|
43 |
-
/* Non-RFC2616 or CONNECT which is weird. */
|
44 |
-
return (pipe);
|
45 |
-
}
|
46 |
-
|
47 |
-
# purge request
|
48 |
-
if (req.request == "PURGE") {
|
49 |
-
if (!client.ip ~ purge) {
|
50 |
-
error 405 "Not allowed.";
|
51 |
-
}
|
52 |
-
purge("obj.http.X-Purge-Host ~ " req.http.X-Purge-Host " && obj.http.X-Purge-URL ~ " req.http.X-Purge-Regex " && obj.http.Content-Type ~ " req.http.X-Purge-Content-Type);
|
53 |
-
error 200 "Purged.";
|
54 |
-
}
|
55 |
-
|
56 |
-
# switch to admin backend configuration
|
57 |
-
if (req.http.cookie ~ "adminhtml=") {
|
58 |
-
set req.backend = admin;
|
59 |
-
}
|
60 |
-
|
61 |
-
# we only deal with GET and HEAD by default
|
62 |
-
if (req.request != "GET" && req.request != "HEAD") {
|
63 |
-
return (pass);
|
64 |
-
}
|
65 |
-
|
66 |
-
# normalize url in case of leading HTTP scheme and domain
|
67 |
-
set req.url = regsub(req.url, "^http[s]?://[^/]+", "");
|
68 |
-
|
69 |
-
# static files are always cacheable. remove SSL flag and cookie
|
70 |
-
if (req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$") {
|
71 |
-
unset req.http.Https;
|
72 |
-
unset req.http.Cookie;
|
73 |
-
}
|
74 |
-
|
75 |
-
# not cacheable by default
|
76 |
-
if (req.http.Authorization || req.http.Https) {
|
77 |
-
return (pass);
|
78 |
-
}
|
79 |
-
|
80 |
-
# do not cache any page from
|
81 |
-
# - index files
|
82 |
-
# - ...
|
83 |
-
if (req.url ~ "^/(index)") {
|
84 |
-
return (pass);
|
85 |
-
}
|
86 |
-
|
87 |
-
# as soon as we have a NO_CACHE cookie pass request
|
88 |
-
if (req.http.cookie ~ "NO_CACHE=") {
|
89 |
-
return (pass);
|
90 |
-
}
|
91 |
-
|
92 |
-
# normalize Aceept-Encoding header
|
93 |
-
# http://varnish.projects.linpro.no/wiki/FAQ/Compression
|
94 |
-
if (req.http.Accept-Encoding) {
|
95 |
-
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
|
96 |
-
# No point in compressing these
|
97 |
-
remove req.http.Accept-Encoding;
|
98 |
-
} elsif (req.http.Accept-Encoding ~ "gzip") {
|
99 |
-
set req.http.Accept-Encoding = "gzip";
|
100 |
-
} elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
|
101 |
-
set req.http.Accept-Encoding = "deflate";
|
102 |
-
} else {
|
103 |
-
# unkown algorithm
|
104 |
-
remove req.http.Accept-Encoding;
|
105 |
-
}
|
106 |
-
}
|
107 |
-
|
108 |
-
# remove Google gclid parameters
|
109 |
-
set req.url = regsuball(req.url,"\?gclid=[^&]+$",""); # strips when QS = "?gclid=AAA"
|
110 |
-
set req.url = regsuball(req.url,"\?gclid=[^&]+&","?"); # strips when QS = "?gclid=AAA&foo=bar"
|
111 |
-
set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
|
112 |
-
|
113 |
-
return (lookup);
|
114 |
-
}
|
115 |
-
|
116 |
-
# sub vcl_pipe {
|
117 |
-
# # Note that only the first request to the backend will have
|
118 |
-
# # X-Forwarded-For set. If you use X-Forwarded-For and want to
|
119 |
-
# # have it set for all requests, make sure to have:
|
120 |
-
# # set bereq.http.connection = "close";
|
121 |
-
# # here. It is not set by default as it might break some broken web
|
122 |
-
# # applications, like IIS with NTLM authentication.
|
123 |
-
# return (pipe);
|
124 |
-
# }
|
125 |
-
#
|
126 |
-
# sub vcl_pass {
|
127 |
-
# return (pass);
|
128 |
-
# }
|
129 |
-
#
|
130 |
-
sub vcl_hash {
|
131 |
-
set req.hash += req.url;
|
132 |
-
if (req.http.host) {
|
133 |
-
set req.hash += req.http.host;
|
134 |
-
} else {
|
135 |
-
set req.hash += server.ip;
|
136 |
-
}
|
137 |
-
if (!(req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$")) {
|
138 |
-
call design_exception;
|
139 |
-
}
|
140 |
-
return (hash);
|
141 |
-
}
|
142 |
-
#
|
143 |
-
# sub vcl_hit {
|
144 |
-
# if (!obj.cacheable) {
|
145 |
-
# return (pass);
|
146 |
-
# }
|
147 |
-
# return (deliver);
|
148 |
-
# }
|
149 |
-
#
|
150 |
-
# sub vcl_miss {
|
151 |
-
# return (fetch);
|
152 |
-
# }
|
153 |
-
|
154 |
-
sub vcl_fetch {
|
155 |
-
if (beresp.status == 500) {
|
156 |
-
set beresp.saintmode = 10s;
|
157 |
-
restart;
|
158 |
-
}
|
159 |
-
set beresp.grace = 5m;
|
160 |
-
|
161 |
-
# add ban-lurker tags to object
|
162 |
-
set beresp.http.X-Purge-URL = req.url;
|
163 |
-
set beresp.http.X-Purge-Host = req.http.host;
|
164 |
-
|
165 |
-
if (beresp.status == 200 || beresp.status == 301 || beresp.status == 404) {
|
166 |
-
if (beresp.http.Content-Type ~ "text/html" || beresp.http.Content-Type ~ "text/xml") {
|
167 |
-
if ((beresp.http.Set-Cookie ~ "NO_CACHE=") || (beresp.ttl < 1s)) {
|
168 |
-
set beresp.ttl = 0s;
|
169 |
-
return (pass);
|
170 |
-
}
|
171 |
-
|
172 |
-
# marker for vcl_deliver to reset Age:
|
173 |
-
set beresp.http.magicmarker = "1";
|
174 |
-
|
175 |
-
# Don't cache cookies
|
176 |
-
unset beresp.http.set-cookie;
|
177 |
-
} else {
|
178 |
-
# set default TTL value for static content
|
179 |
-
set beresp.ttl = 4h;
|
180 |
-
}
|
181 |
-
return (deliver);
|
182 |
-
}
|
183 |
-
|
184 |
-
return (pass);
|
185 |
-
}
|
186 |
-
|
187 |
-
sub vcl_deliver {
|
188 |
-
# debug info
|
189 |
-
if (resp.http.X-Cache-Debug) {
|
190 |
-
if (obj.hits > 0) {
|
191 |
-
set resp.http.X-Cache = "HIT";
|
192 |
-
set resp.http.X-Cache-Hits = obj.hits;
|
193 |
-
} else {
|
194 |
-
set resp.http.X-Cache = "MISS";
|
195 |
-
}
|
196 |
-
set resp.http.X-Cache-Expires = resp.http.Expires;
|
197 |
-
} else {
|
198 |
-
# remove Varnish/proxy header
|
199 |
-
remove resp.http.X-Varnish;
|
200 |
-
remove resp.http.Via;
|
201 |
-
remove resp.http.Age;
|
202 |
-
remove resp.http.X-Purge-URL;
|
203 |
-
remove resp.http.X-Purge-Host;
|
204 |
-
}
|
205 |
-
|
206 |
-
if (resp.http.magicmarker) {
|
207 |
-
# Remove the magic marker
|
208 |
-
unset resp.http.magicmarker;
|
209 |
-
|
210 |
-
set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
|
211 |
-
set resp.http.Pragma = "no-cache";
|
212 |
-
set resp.http.Expires = "Mon, 31 Mar 2008 10:00:00 GMT";
|
213 |
-
set resp.http.Age = "0";
|
214 |
-
}
|
215 |
-
}
|
216 |
-
|
217 |
-
# sub vcl_error {
|
218 |
-
# set obj.http.Content-Type = "text/html; charset=utf-8";
|
219 |
-
# synthetic {"
|
220 |
-
# <?xml version="1.0" encoding="utf-8"?>
|
221 |
-
# <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
222 |
-
# "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
223 |
-
# <html>
|
224 |
-
# <head>
|
225 |
-
# <title>"} obj.status " " obj.response {"</title>
|
226 |
-
# </head>
|
227 |
-
# <body>
|
228 |
-
# <h1>Error "} obj.status " " obj.response {"</h1>
|
229 |
-
# <p>"} obj.response {"</p>
|
230 |
-
# <h3>Guru Meditation:</h3>
|
231 |
-
# <p>XID: "} req.xid {"</p>
|
232 |
-
# <hr>
|
233 |
-
# <p>Varnish cache server</p>
|
234 |
-
# </body>
|
235 |
-
# </html>
|
236 |
-
# "};
|
237 |
-
# return (deliver);
|
238 |
-
# }
|
239 |
-
|
240 |
-
sub design_exception {
|
241 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Phoenix/VarnishCache/etc/default_3.0.vcl
CHANGED
@@ -20,6 +20,7 @@ acl purge {
|
|
20 |
"127.0.0.1";
|
21 |
}
|
22 |
|
|
|
23 |
|
24 |
sub vcl_recv {
|
25 |
if (req.restarts == 0) {
|
@@ -30,19 +31,19 @@ sub vcl_recv {
|
|
30 |
set req.http.X-Forwarded-For = client.ip;
|
31 |
}
|
32 |
}
|
33 |
-
|
34 |
if (req.request != "GET" &&
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
/* Non-RFC2616 or CONNECT which is weird. */
|
43 |
return (pipe);
|
44 |
}
|
45 |
-
|
46 |
# purge request
|
47 |
if (req.request == "PURGE") {
|
48 |
if (!client.ip ~ purge) {
|
@@ -57,14 +58,17 @@ sub vcl_recv {
|
|
57 |
set req.backend = admin;
|
58 |
}
|
59 |
|
60 |
-
# we only deal with GET and HEAD by default
|
61 |
if (req.request != "GET" && req.request != "HEAD") {
|
62 |
return (pass);
|
63 |
}
|
64 |
-
|
65 |
# normalize url in case of leading HTTP scheme and domain
|
66 |
set req.url = regsub(req.url, "^http[s]?://[^/]+", "");
|
67 |
-
|
|
|
|
|
|
|
68 |
# static files are always cacheable. remove SSL flag and cookie
|
69 |
if (req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$") {
|
70 |
unset req.http.Https;
|
@@ -76,9 +80,7 @@ sub vcl_recv {
|
|
76 |
return (pass);
|
77 |
}
|
78 |
|
79 |
-
# do not cache any page from
|
80 |
-
# - index files
|
81 |
-
# - ...
|
82 |
if (req.url ~ "^/(index)") {
|
83 |
return (pass);
|
84 |
}
|
@@ -88,27 +90,11 @@ sub vcl_recv {
|
|
88 |
return (pass);
|
89 |
}
|
90 |
|
91 |
-
# normalize Aceept-Encoding header
|
92 |
-
# http://varnish.projects.linpro.no/wiki/FAQ/Compression
|
93 |
-
if (req.http.Accept-Encoding) {
|
94 |
-
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
|
95 |
-
# No point in compressing these
|
96 |
-
remove req.http.Accept-Encoding;
|
97 |
-
} elsif (req.http.Accept-Encoding ~ "gzip") {
|
98 |
-
set req.http.Accept-Encoding = "gzip";
|
99 |
-
} elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
|
100 |
-
set req.http.Accept-Encoding = "deflate";
|
101 |
-
} else {
|
102 |
-
# unkown algorithm
|
103 |
-
remove req.http.Accept-Encoding;
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
# remove Google gclid parameters
|
108 |
set req.url = regsuball(req.url,"\?gclid=[^&]+$",""); # strips when QS = "?gclid=AAA"
|
109 |
set req.url = regsuball(req.url,"\?gclid=[^&]+&","?"); # strips when QS = "?gclid=AAA&foo=bar"
|
110 |
set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
|
111 |
-
|
112 |
return (lookup);
|
113 |
}
|
114 |
|
@@ -121,11 +107,11 @@ sub vcl_recv {
|
|
121 |
# # applications, like IIS with NTLM authentication.
|
122 |
# return (pipe);
|
123 |
# }
|
124 |
-
#
|
125 |
# sub vcl_pass {
|
126 |
# return (pass);
|
127 |
# }
|
128 |
-
#
|
129 |
sub vcl_hash {
|
130 |
hash_data(req.url);
|
131 |
if (req.http.host) {
|
@@ -133,16 +119,27 @@ sub vcl_hash {
|
|
133 |
} else {
|
134 |
hash_data(server.ip);
|
135 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
if (!(req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$")) {
|
137 |
call design_exception;
|
138 |
}
|
139 |
return (hash);
|
140 |
}
|
141 |
-
#
|
142 |
# sub vcl_hit {
|
143 |
# return (deliver);
|
144 |
# }
|
145 |
-
#
|
146 |
# sub vcl_miss {
|
147 |
# return (fetch);
|
148 |
# }
|
@@ -154,10 +151,15 @@ sub vcl_fetch {
|
|
154 |
}
|
155 |
set beresp.grace = 5m;
|
156 |
|
|
|
|
|
|
|
|
|
|
|
157 |
# add ban-lurker tags to object
|
158 |
set beresp.http.X-Purge-URL = req.url;
|
159 |
set beresp.http.X-Purge-Host = req.http.host;
|
160 |
-
|
161 |
if (beresp.status == 200 || beresp.status == 301 || beresp.status == 404) {
|
162 |
if (beresp.http.Content-Type ~ "text/html" || beresp.http.Content-Type ~ "text/xml") {
|
163 |
if ((beresp.http.Set-Cookie ~ "NO_CACHE=") || (beresp.ttl < 1s)) {
|
@@ -167,7 +169,7 @@ sub vcl_fetch {
|
|
167 |
|
168 |
# marker for vcl_deliver to reset Age:
|
169 |
set beresp.http.magicmarker = "1";
|
170 |
-
|
171 |
# Don't cache cookies
|
172 |
unset beresp.http.set-cookie;
|
173 |
} else {
|
@@ -176,7 +178,7 @@ sub vcl_fetch {
|
|
176 |
}
|
177 |
return (deliver);
|
178 |
}
|
179 |
-
|
180 |
return (hit_for_pass);
|
181 |
}
|
182 |
|
@@ -198,7 +200,7 @@ sub vcl_deliver {
|
|
198 |
remove resp.http.X-Purge-URL;
|
199 |
remove resp.http.X-Purge-Host;
|
200 |
}
|
201 |
-
|
202 |
if (resp.http.magicmarker) {
|
203 |
# Remove the magic marker
|
204 |
unset resp.http.magicmarker;
|
@@ -233,11 +235,11 @@ sub vcl_deliver {
|
|
233 |
# "};
|
234 |
# return (deliver);
|
235 |
# }
|
236 |
-
#
|
237 |
# sub vcl_init {
|
238 |
# return (ok);
|
239 |
# }
|
240 |
-
#
|
241 |
# sub vcl_fini {
|
242 |
# return (ok);
|
243 |
# }
|
20 |
"127.0.0.1";
|
21 |
}
|
22 |
|
23 |
+
import std;
|
24 |
|
25 |
sub vcl_recv {
|
26 |
if (req.restarts == 0) {
|
31 |
set req.http.X-Forwarded-For = client.ip;
|
32 |
}
|
33 |
}
|
34 |
+
|
35 |
if (req.request != "GET" &&
|
36 |
+
req.request != "HEAD" &&
|
37 |
+
req.request != "PUT" &&
|
38 |
+
req.request != "POST" &&
|
39 |
+
req.request != "TRACE" &&
|
40 |
+
req.request != "OPTIONS" &&
|
41 |
+
req.request != "DELETE" &&
|
42 |
+
req.request != "PURGE") {
|
43 |
/* Non-RFC2616 or CONNECT which is weird. */
|
44 |
return (pipe);
|
45 |
}
|
46 |
+
|
47 |
# purge request
|
48 |
if (req.request == "PURGE") {
|
49 |
if (!client.ip ~ purge) {
|
58 |
set req.backend = admin;
|
59 |
}
|
60 |
|
61 |
+
# we only deal with GET and HEAD by default
|
62 |
if (req.request != "GET" && req.request != "HEAD") {
|
63 |
return (pass);
|
64 |
}
|
65 |
+
|
66 |
# normalize url in case of leading HTTP scheme and domain
|
67 |
set req.url = regsub(req.url, "^http[s]?://[^/]+", "");
|
68 |
+
|
69 |
+
# collect all cookies
|
70 |
+
std.collect(req.http.Cookie);
|
71 |
+
|
72 |
# static files are always cacheable. remove SSL flag and cookie
|
73 |
if (req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$") {
|
74 |
unset req.http.Https;
|
80 |
return (pass);
|
81 |
}
|
82 |
|
83 |
+
# do not cache any page from index files
|
|
|
|
|
84 |
if (req.url ~ "^/(index)") {
|
85 |
return (pass);
|
86 |
}
|
90 |
return (pass);
|
91 |
}
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
# remove Google gclid parameters
|
94 |
set req.url = regsuball(req.url,"\?gclid=[^&]+$",""); # strips when QS = "?gclid=AAA"
|
95 |
set req.url = regsuball(req.url,"\?gclid=[^&]+&","?"); # strips when QS = "?gclid=AAA&foo=bar"
|
96 |
set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
|
97 |
+
|
98 |
return (lookup);
|
99 |
}
|
100 |
|
107 |
# # applications, like IIS with NTLM authentication.
|
108 |
# return (pipe);
|
109 |
# }
|
110 |
+
#
|
111 |
# sub vcl_pass {
|
112 |
# return (pass);
|
113 |
# }
|
114 |
+
#
|
115 |
sub vcl_hash {
|
116 |
hash_data(req.url);
|
117 |
if (req.http.host) {
|
119 |
} else {
|
120 |
hash_data(server.ip);
|
121 |
}
|
122 |
+
|
123 |
+
if (req.http.cookie ~ "PAGECACHE_ENV=") {
|
124 |
+
set req.http.pageCacheEnv = regsub(
|
125 |
+
req.http.cookie,
|
126 |
+
"(.*)PAGECACHE-env=([^&]*)(.*)",
|
127 |
+
"\2"
|
128 |
+
);
|
129 |
+
hash_data(req.http.pageCacheEnv);
|
130 |
+
remove req.http.pageCacheEnv;
|
131 |
+
}
|
132 |
+
|
133 |
if (!(req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$")) {
|
134 |
call design_exception;
|
135 |
}
|
136 |
return (hash);
|
137 |
}
|
138 |
+
#
|
139 |
# sub vcl_hit {
|
140 |
# return (deliver);
|
141 |
# }
|
142 |
+
#
|
143 |
# sub vcl_miss {
|
144 |
# return (fetch);
|
145 |
# }
|
151 |
}
|
152 |
set beresp.grace = 5m;
|
153 |
|
154 |
+
# enable ESI feature if needed
|
155 |
+
if (beresp.http.X-Cache-DoEsi == "1") {
|
156 |
+
set beresp.do_esi = true;
|
157 |
+
}
|
158 |
+
|
159 |
# add ban-lurker tags to object
|
160 |
set beresp.http.X-Purge-URL = req.url;
|
161 |
set beresp.http.X-Purge-Host = req.http.host;
|
162 |
+
|
163 |
if (beresp.status == 200 || beresp.status == 301 || beresp.status == 404) {
|
164 |
if (beresp.http.Content-Type ~ "text/html" || beresp.http.Content-Type ~ "text/xml") {
|
165 |
if ((beresp.http.Set-Cookie ~ "NO_CACHE=") || (beresp.ttl < 1s)) {
|
169 |
|
170 |
# marker for vcl_deliver to reset Age:
|
171 |
set beresp.http.magicmarker = "1";
|
172 |
+
|
173 |
# Don't cache cookies
|
174 |
unset beresp.http.set-cookie;
|
175 |
} else {
|
178 |
}
|
179 |
return (deliver);
|
180 |
}
|
181 |
+
|
182 |
return (hit_for_pass);
|
183 |
}
|
184 |
|
200 |
remove resp.http.X-Purge-URL;
|
201 |
remove resp.http.X-Purge-Host;
|
202 |
}
|
203 |
+
|
204 |
if (resp.http.magicmarker) {
|
205 |
# Remove the magic marker
|
206 |
unset resp.http.magicmarker;
|
235 |
# "};
|
236 |
# return (deliver);
|
237 |
# }
|
238 |
+
#
|
239 |
# sub vcl_init {
|
240 |
# return (ok);
|
241 |
# }
|
242 |
+
#
|
243 |
# sub vcl_fini {
|
244 |
# return (ok);
|
245 |
# }
|
app/code/community/Phoenix/VarnishCache/etc/system.xml
CHANGED
@@ -15,28 +15,41 @@
|
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
22 |
<config>
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<sections>
|
24 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
<groups>
|
26 |
-
<
|
27 |
-
<
|
|
|
28 |
<show_in_default>1</show_in_default>
|
29 |
<show_in_website>1</show_in_website>
|
30 |
<show_in_store>1</show_in_store>
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
<fields>
|
33 |
-
<versioninfo>
|
34 |
-
<frontend_model>varnishcache/adminhtml_system_config_fieldset_versioninfo</frontend_model>
|
35 |
-
<sort_order>0</sort_order>
|
36 |
-
<show_in_default>1</show_in_default>
|
37 |
-
<show_in_website>1</show_in_website>
|
38 |
-
<show_in_store>1</show_in_store>
|
39 |
-
</versioninfo>
|
40 |
<enabled translate="label comment">
|
41 |
<label>Enable cache module</label>
|
42 |
<frontend_type>select</frontend_type>
|
@@ -164,8 +177,8 @@
|
|
164 |
<depends><enabled>1</enabled></depends>
|
165 |
</debug>
|
166 |
</fields>
|
167 |
-
</
|
168 |
</groups>
|
169 |
-
</
|
170 |
</sections>
|
171 |
</config>
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
22 |
<config>
|
23 |
+
<tabs>
|
24 |
+
<phoenix_media>
|
25 |
+
<label>PHOENIX MEDIA</label>
|
26 |
+
<sort_order>250</sort_order>
|
27 |
+
</phoenix_media>
|
28 |
+
</tabs>
|
29 |
<sections>
|
30 |
+
<varnishcache translate="label" module="varnishcache">
|
31 |
+
<label>PageCache powered by Varnish</label>
|
32 |
+
<tab>phoenix_media</tab>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>900</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
<groups>
|
39 |
+
<versioninfo>
|
40 |
+
<frontend_model>varnishcache/adminhtml_system_config_fieldset_versioninfo</frontend_model>
|
41 |
+
<sort_order>0</sort_order>
|
42 |
<show_in_default>1</show_in_default>
|
43 |
<show_in_website>1</show_in_website>
|
44 |
<show_in_store>1</show_in_store>
|
45 |
+
</versioninfo>
|
46 |
+
<general translate="label comment" module="varnishcache">
|
47 |
+
<label>General Settings</label>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
<sort_order>10</sort_order>
|
52 |
<fields>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
<enabled translate="label comment">
|
54 |
<label>Enable cache module</label>
|
55 |
<frontend_type>select</frontend_type>
|
177 |
<depends><enabled>1</enabled></depends>
|
178 |
</debug>
|
179 |
</fields>
|
180 |
+
</general>
|
181 |
</groups>
|
182 |
+
</varnishcache>
|
183 |
</sections>
|
184 |
</config>
|
app/code/community/Phoenix/VarnishCache/sql/varnishcache_setup/install-4.0.0.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* PageCache powered by Varnish
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to support@phoenix-media.eu so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Phoenix
|
16 |
+
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
+
|
21 |
+
$installer = $this;
|
22 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
23 |
+
|
24 |
+
$installer->startSetup();
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Update existing configuration to new paths
|
28 |
+
*/
|
29 |
+
$installer->run(
|
30 |
+
'UPDATE '.$installer->getTable('core/config_data').'
|
31 |
+
SET path = REPLACE(path, "system/varnishcache/", "varnishcache/general/")
|
32 |
+
WHERE path LIKE "system/varnishcache%"'
|
33 |
+
);
|
34 |
+
|
35 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/varnishcache.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
app/design/adminhtml/default/default/template/varnishcache/cache/additional.phtml
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
?>
|
14 |
*
|
15 |
* @category Phoenix
|
16 |
* @package Phoenix_VarnishCache
|
17 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
?>
|
app/etc/modules/Phoenix_VarnishCache.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
app/etc/varnishcache.xml
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
-
* @copyright Copyright (c) 2011 PHOENIX MEDIA GmbH
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
15 |
*
|
16 |
* @category Phoenix
|
17 |
* @package Phoenix_VarnishCache
|
18 |
+
* @copyright Copyright (c) 2011-2013 PHOENIX MEDIA GmbH (http://www.phoenix-media.eu)
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
-->
|
app/locale/de_DE/Phoenix_VarnishCache.csv
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
"HTML","HTML"
|
18 |
"Images","Bilder"
|
19 |
"JavaScript","JavaScript"
|
20 |
-
"PageCache powered by Varnish
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community Version: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","X-Header für Debugging an den Client weitergeben und PURGE-Requests in /var/log/varnish_cache.log schreiben (Entwickler-Log muss aktiviert sein)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Port der Varnish Server (e.g. 8080)"
|
17 |
"HTML","HTML"
|
18 |
"Images","Bilder"
|
19 |
"JavaScript","JavaScript"
|
20 |
+
"PageCache powered by Varnish Settings","PageCache powered by Varnish Einstellungen"
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community Version: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","X-Header für Debugging an den Client weitergeben und PURGE-Requests in /var/log/varnish_cache.log schreiben (Entwickler-Log muss aktiviert sein)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Port der Varnish Server (e.g. 8080)"
|
app/locale/en_US/Phoenix_VarnishCache.csv
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
"HTML","HTML"
|
18 |
"Images","Images"
|
19 |
"JavaScript","JavaScript"
|
20 |
-
"PageCache powered by Varnish
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community version: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Port of the Varnish servers (e.g. 8080)"
|
17 |
"HTML","HTML"
|
18 |
"Images","Images"
|
19 |
"JavaScript","JavaScript"
|
20 |
+
"PageCache powered by Varnish Settings","PageCache powered by Varnish settings"
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community version: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Port of the Varnish servers (e.g. 8080)"
|
app/locale/es_ES/Phoenix_VarnishCache.csv
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
"HTML","HTML"
|
18 |
"Images","Imágenes"
|
19 |
"JavaScript","JavaScript"
|
20 |
-
"PageCache powered by Varnish
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community versión: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","Pase HTTP X-encabezados para propósitos de depuraciónen al cliente y registre las solicitudes de purge en /var/log/varnish_cache.log (asegúrese de que el registro para desarrolladores está habilitado)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Puerto de los servidores de Varnish (por ejemplo 8080)"
|
17 |
"HTML","HTML"
|
18 |
"Images","Imágenes"
|
19 |
"JavaScript","JavaScript"
|
20 |
+
"PageCache powered by Varnish Settings","PageCache powered by Varnish configuración"
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community versión: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","Pase HTTP X-encabezados para propósitos de depuraciónen al cliente y registre las solicitudes de purge en /var/log/varnish_cache.log (asegúrese de que el registro para desarrolladores está habilitado)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Puerto de los servidores de Varnish (por ejemplo 8080)"
|
app/locale/fr_FR/Phoenix_VarnishCache.csv
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
"HTML","HTML"
|
18 |
"Images","Images"
|
19 |
"JavaScript","JavaScript"
|
20 |
-
"PageCache powered by Varnish
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community version: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Port of the Varnish servers (e.g. 8080)"
|
17 |
"HTML","HTML"
|
18 |
"Images","Images"
|
19 |
"JavaScript","JavaScript"
|
20 |
+
"PageCache powered by Varnish Settings","PageCache powered by Varnish settings"
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community version: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Port of the Varnish servers (e.g. 8080)"
|
app/locale/nb_NO/Phoenix_VarnishCache.csv
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
"HTML","HTML"
|
18 |
"Images","Bilder"
|
19 |
"JavaScript","JavaScript"
|
20 |
-
"PageCache powered by Varnish
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community versjon: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","Pass HTTP X-headere for debugging formål til klienten og logg purge forespørsler til /var/log/varnish_cache.log (husk å sikre at utvikleren loggen er aktivert)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Porten for Varnish-servere (f.eks. 8080)"
|
17 |
"HTML","HTML"
|
18 |
"Images","Bilder"
|
19 |
"JavaScript","JavaScript"
|
20 |
+
"PageCache powered by Varnish Settings","PageCache powered by Varnish innstillinger"
|
21 |
"PageCache powered by Varnish Community version: %s","PageCache powered by Varnish Community versjon: %s"
|
22 |
"Pass X-headers for debugging purpose to the client and log purge requests to /var/log/varnish_cache.log (ensure developer log is enabled).","Pass HTTP X-headere for debugging formål til klienten og logg purge forespørsler til /var/log/varnish_cache.log (husk å sikre at utvikleren loggen er aktivert)."
|
23 |
"Port of the Varnish servers (e.g. 8080)","Porten for Varnish-servere (f.eks. 8080)"
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Varnish_Cache</name>
|
4 |
-
<version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
@@ -14,11 +14,17 @@
|
|
14 |
<p> </p>
|
15 |
<p><strong>Features:</strong></p>
|
16 |
<p>- Allows <strong>full page caching</strong> of Magento store frontends with <a href="http://www.varnish-cache.org" target="_blank">Varnish</a><br />- Prevent caching of pages containing custom information (shopping carts, logins)<br />- Configure request paths (controller, action) to be excluded from caching<br />- Clean caches for single store views or content types<br />- Maintain several Varnish instances from the Magento backend<br />- Set TTL for content pages per store view<br />- Deactivate Varnish cache for single store views or websites<br />- Easily deactivate caching for certain Magento modules<br />- Enable debug mode to analyse any issues<br /><strong>- Ready to go Varnish configuration file (VCL)</strong></p></description>
|
17 |
-
<notes>-
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
<authors><author><name>PHOENIX MEDIA</name><user>auto-converted</user><email>info@phoenix-media.eu</email></author></authors>
|
19 |
-
<date>
|
20 |
-
<time>
|
21 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="varnishcache.xml" hash="
|
22 |
<compatible/>
|
23 |
<dependencies/>
|
24 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Varnish_Cache</name>
|
4 |
+
<version>4.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
<channel>community</channel>
|
14 |
<p> </p>
|
15 |
<p><strong>Features:</strong></p>
|
16 |
<p>- Allows <strong>full page caching</strong> of Magento store frontends with <a href="http://www.varnish-cache.org" target="_blank">Varnish</a><br />- Prevent caching of pages containing custom information (shopping carts, logins)<br />- Configure request paths (controller, action) to be excluded from caching<br />- Clean caches for single store views or content types<br />- Maintain several Varnish instances from the Magento backend<br />- Set TTL for content pages per store view<br />- Deactivate Varnish cache for single store views or websites<br />- Easily deactivate caching for certain Magento modules<br />- Enable debug mode to analyse any issues<br /><strong>- Ready to go Varnish configuration file (VCL)</strong></p></description>
|
17 |
+
<notes>- added store and currency switch support
|
18 |
+
- added advanced message handling
|
19 |
+
- added Varnish ESI support for basic blocks (sidebar/mini cart, top links, welcome message, last viewed and compared products)
|
20 |
+
- raised Magento version requirements to CE 1.5.1 and EE 1.9
|
21 |
+
- dropped support for Varnish 2.x
|
22 |
+
- moved configuration in separate tab
|
23 |
+
- small bugfixes</notes>
|
24 |
<authors><author><name>PHOENIX MEDIA</name><user>auto-converted</user><email>info@phoenix-media.eu</email></author></authors>
|
25 |
+
<date>2013-04-22</date>
|
26 |
+
<time>15:36:15</time>
|
27 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="varnishcache.xml" hash="2454a4ad3e9bede38bb1b2ccff46fd95"/></dir><dir name="template"><dir name="varnishcache"><dir name="cache"><file name="additional.phtml" hash="486f1e32ff3f020200d91bcb81c20cad"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="de_DE"><file name="Phoenix_VarnishCache.csv" hash="fcd310b9d66d55abe92df78272edefb6"/></dir><dir name="en_US"><file name="Phoenix_VarnishCache.csv" hash="8fcaa3e009cf8ccec3e92b374a78a736"/></dir><dir name="es_ES"><file name="Phoenix_VarnishCache.csv" hash="eeaf2afe930687a4e5cdca5ffa02eb5b"/></dir><dir name="fr_FR"><file name="Phoenix_VarnishCache.csv" hash="f1926328dbd4bae4c23e585b7afb8309"/></dir><dir name="nb_NO"><file name="Phoenix_VarnishCache.csv" hash="077ab381e4eb8a50e638743a8fcf4fe6"/></dir></target><target name="mageetc"><dir name="modules"><file name="Phoenix_VarnishCache.xml" hash="09b2744bddf997a78cfb624ce6be20aa"/></dir><dir name="."><file name="varnishcache.xml" hash="8fdb975ad8c93e472486f3867a056b18"/></dir></target><target name="magecommunity"><dir name="Phoenix"><dir name="VarnishCache"><dir name="Block"><dir name="Adminhtml"><dir name="Cache"><file name="Additional.php" hash="44a8dc640984917ae31e5a2d450e8fba"/></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="RouteTTL.php" hash="de6271e60800ac70c9089c74b434a059"/><file name="Versioninfo.php" hash="add2ed546fad4a0f5617ea97165e73c0"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="VarnishCacheController.php" hash="32381c357ce32712c5efed8daf230c50"/></dir></dir><dir name="etc"><file name="config.xml" hash="f5ad1dcbe5b11917c126cb25a1bf8753"/><file name="default_3.0.vcl" hash="d71bf6785ccbb581a72657463958a4ea"/><file name="system.xml" hash="78061a0fa7bee61a2e07f9253c79d6d6"/></dir><dir name="Helper"><dir name="Control"><dir name="Catalog"><file name="Category.php" hash="e58a8770c92b0ea2e2ff5bd892d334c2"/><file name="Product.php" hash="9de4d4b30c42fba3d9f9c08be3a538e2"/></dir><dir name="Cms"><file name="Page.php" hash="2cffdefd0c885c7e7c5e194b3e961c93"/></dir></dir><file name="Cache.php" hash="fa9e7056bd8313046c81be2243b9d58a"/><file name="Data.php" hash="949ba1821c33dea347b4dcc922b55a80"/></dir><dir name="Model"><dir name="Catalog"><dir name="Category"><file name="Product.php" hash="76fc154142e1c3aa59048107decf623e"/></dir><dir name="Product"><file name="Relation.php" hash="ad3a5929041ee76f3580aedf2b971356"/></dir></dir><dir name="Cms"><dir name="Page"><file name="Store.php" hash="1c7ab8d36e106d5e05d8042eaba7edc9"/></dir></dir><dir name="Control"><dir name="Catalog"><file name="Category.php" hash="b8a0d4e2256dae6c058cb830fe10e868"/><file name="Product.php" hash="18bb7d8df378051dab6b049bf9efedfe"/></dir><dir name="Cms"><file name="Page.php" hash="ad8480b584c64242b6311a3e35c23e5d"/></dir><file name="Abstract.php" hash="8d09e21ac95b81ac7a6575b23bd73a29"/></dir><dir name="Resource"><dir name="Mysql4"><dir name="Catalog"><dir name="Category"><dir name="Product"><file name="Collection.php" hash="75d70fef15bfde606fde7c1bbc7841d3"/></dir><file name="Product.php" hash="f429e2db437f16a679de9dbd9da28b30"/></dir><dir name="Product"><dir name="Relation"><file name="Collection.php" hash="c08fdc136ef5e2c4ef10361cf98067a5"/></dir></dir></dir><dir name="Cms"><dir name="Page"><dir name="Store"><file name="Collection.php" hash="a63387a48e2f96fbfb9b4b7a157b85d1"/></dir><file name="Store.php" hash="bb7f0738ded20199b1994ede2499fe8b"/></dir></dir><dir name="Core"><dir name="Url"><dir name="Rewrite"><file name="Collection.php" hash="e808bb4ff25ace9a4e6b3c4fa11c2888"/></dir></dir></dir></dir></dir><file name="Control.php" hash="10dc0c4d6153902c0bf42c826ae41187"/><file name="Observer.php" hash="bba98752742e3dcdd82b76856b16e970"/><file name="Processor.php" hash="d246663026bc67d74a262ab5f9a50cc3"/></dir><dir name="sql"><dir name="varnishcache_setup"><file name="install-4.0.0.php" hash="c39a62488663a0dc26f85542b9188a9d"/></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="README_VARNISH_CACHE.txt" hash="052cddbe269466e357478db8bc4eb9b7"/></dir></target></contents>
|
28 |
<compatible/>
|
29 |
<dependencies/>
|
30 |
</package>
|