Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent Varnish from creating cache variations of static files #988

Merged
merged 3 commits into from
Jan 22, 2015

Conversation

PHOENIX-MEDIA
Copy link

In the vcl_hash routine cookie values are read to create cache variations of the same URL which makes only sense for HTML pages. Static files will never change and therefore shouldn't be stored in variations.
The VCL change removes schema and cookies for static files before calling vcl_hash to ensure only one cache element is created.

@kokoc
Copy link
Member

kokoc commented Jan 21, 2015

@PHOENIX-MEDIA Thank you for contribution.
Seems like pull request is based on Magento 1 code base, that has different directory structure for static resources. Could you please fix it and also add woff and svg files to the list?

Related issue - #721

@PHOENIX-MEDIA
Copy link
Author

Right, I've fixed the file path for /pub/.

@kurtinge
Copy link

Shouldn't the regexp be something like this ?

if (req.url ~ "^/(pub/)?(media|static)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico|woff|svg)$") {

To allow that the pub directory can be your docroot ?

@kokoc
Copy link
Member

kokoc commented Jan 21, 2015

@kurtinge Yes, regexp looks great.

@kokoc
Copy link
Member

kokoc commented Jan 21, 2015

@PHOENIX-MEDIA Regexp without "media" and "static" parts can possibly lead to session loss on 404's pages. See #721 for details

@PHOENIX-MEDIA
Copy link
Author

@kurtinge thanks for heads up!
Updated RegEx. Of course cookie must only be removed for static files.

@kokoc
Copy link
Member

kokoc commented Jan 22, 2015

✅ CR: passed
✅ Builds: green
✅ Resolution: ready to merge
✅ Internal reference: MAGETWO-32938

kokoc added a commit that referenced this pull request Jan 22, 2015
Prevent Varnish from creating cache variations of static files
@kokoc kokoc merged commit 1e45a1e into magento:develop Jan 22, 2015
kokoc added a commit that referenced this pull request Jan 30, 2015
Prevent Varnish from creating cache variations of static files
magento-team added a commit to abeeskau/magento2-community-edition that referenced this pull request Feb 9, 2015
* UI improvements:
    * Updated the design of Enable Cookies CMS page
    * Implemented UI improvements for Widgets
    * Fixed the "Help Us to Keep Magento Healthy Report All Bugs (ver. #)" link Magento Admin
    * Various UI improvements
* Various improvements:
    * Implemented Sales Quote as a standalone Magento module
    * Performed custom EAV entities code and DB tables cleanup
    * Eliminating remnants of the Core module:
        * Moved Application Emulation from the Magento_Core module to the Magento_Store module
        * Moved Validator Factory from the Magento_Core module to the Magento Framework
    * Added static integrity test for composer.json files
    * Added PHPMD and PHPCS annotations to the codebase
* Tests improvements:
    * Added MVP tag to the functional tests
    * Created acceptance functional test suite
    * Replaced end-to-end tests for url rewrite creation, CMS page creation, category creation, review creation, customer frontend creation, and tax rule creation with injectable tests
    * Automated test cases for downloadable products with taxes
* Fixed bugs:
    * Fixed an issue where the Discounts and Coupons RSS Feed had incorrect title
    * Fixed an issue where a wrong special price expiration date was displayed in RSS
    * Fixed an issue in the Import functionality where imported files disappeared after the Check Data operation
    * Fixed an issue where the Unsubscribe link in the Newsletter was broken
    * Fixed an issue where stock status changed incorrectly after import
    * Fixed an issue where selected filters and exclude did not work during Export
    * Fixed an issue where tax details order was different on order/invoice/refund create and view pages (
    * Fixed a typo in the getCalculationAlgorithm public function
    * Fixed an issue where the incorrect value of Subtotal Including Tax was displayed in invoices
    * Fixed an issue where tax details were not displayed on a new order
    * Improved pricing performance using caching
    * Fixed an issue where CsvImportHandler tests still referring to links from Tax module instead of TaxImportExport module
    * Fixed an issue where an exception was thrown instead of 404 if altering the url for a product with required configuration on the storefront
    * Fixed an issue where the title of successfully placed order page (was empty
    * Fixed an issue where certain fields were not disabled by default on the website scope in System configuration as expected
    * Fixed an issue where third party interfaces were not supported by single-tenant compiler
    * Eliminated the 'protocol' parameter from the ReadInterface and WriteInterface
* GitHub requests:
    * [#979](magento/magento2#979) -- Adding OSL license file name
    * [#978](magento/magento2#978) -- Added ignore rule for media assets in wysiwyg directory
    * [#877](magento/magento2#877) -- Made Topmenu HTML Editable
    * [#906](magento/magento2#906) -- Add tests for View\Layout\Reader\Block and slight refactoring
    * [#682](magento/magento2#682) -- \Magento\Framework\Pricing\PriceCurrencyInterface depends on Magento application code
    * [#581](magento/magento2#581) -- About ByPercent.php under different currencies
    * [#964](magento/magento2#964) -- Improving documentation for jMeter performance tests
    * [#871](magento/magento2#871) -- Replace Symfony2/Yaml in composer
    * [#990](magento/magento2#990) -- add @see annotation before class to make it recognizable by IDE
    * [#988](magento/magento2#988) -- Prevent Varnish from creating cache variations of static files
* Framework improvements:
    * Improved unit and integration tests coverage
magento-team pushed a commit that referenced this pull request Apr 6, 2017
[Epam] Extend functional test sprint 6

- MTO-128: [Test] Export Products
- MTO-105: [Test] Import Products
- MTO-148: [Constraint] Messages in Sales Reports Pages display correct date/time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants