Module for integrating Fastly CDN with Magento 2 installations

Overview

FASTLY CDN FOR MAGENTO2 DOCUMENTATION

Thank you for using the "Fastly CDN module for Magento2" (Fastly_Cdn).

This package contains everything you need to connect fastly.com (Fastly) with your Magento commerce shop and to get the most out of Fastly's powerful caching capabilities for a blazing fast e-commerce site.

Contents

Description

The Fastly_Cdn module relies on Magento2's page cache functionality and extends its Varnish capabilities to leverage Fastly's enhanced caching technology and Geo-IP support.

The second component, the VCL, configures Fastly's Varnish to process the client requests and Magento's HTML responses according to the Cache-Control headers the Fastly_Cdn module adds to every response.

Documentation

Documentation for this module can be found in the Documentation folder.

Support

Help using this module can be found by posting to Fastly's community forum.

For Fastly customers with a Support Package please reach out via the normal channels.

If there are issues/errors with integrating the module, please post details in the GitHub repository issues.

Features

The module utilises a number of features of Fastly's services. This section will provide a brief overview of the ones available in the Fastly_Cdn module.

Geo IP Detection: Using the client's IP this allows a regional store to be delivered to the user.

Serving Stale on Errors: This allows an expired copy of content to be used in case of errors on the origin. This prevents site outages being visible to users.

Serving Stale while Revalidating: This allows an expired copy of content to be served while the content is refreshed from origin. This maintains performance while keeping a fresh cache.

Soft Purging: This marks content as expired (before the TTL). Using this means that content can be freshened actively while using stale content to users for a fast site.

N.B. More in-depth explanations of these features can be found in Fastly's Documentation.

Contributing

We welcome pull requests for issues and new functionality. Please see Contributing for more details.

Comments
  • Fastly geoip redirect to the same store

    Fastly geoip redirect to the same store

    If my default and current store are en_us and the popup come and offer me to switch to the en_ca store I am redirected to the current store en_us. I can reach the en_ca store with magento 2.2.6 and 2.2.7

    opened by mackendy 29
  • 503 Service Unavailable error when requesting 'admin/fastlyCdn_Edge_Dictionary/ListAll'

    503 Service Unavailable error when requesting 'admin/fastlyCdn_Edge_Dictionary/ListAll'

    Hi guys

    Yesterday we enabled Fastly on a staging environment of the Magento Cloud.

    But we sometimes see errors popping up in random adminhtml pages under Stores > Configuration (not only in Advanced > System), this error is displayed in a red box: A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.

    When looking through the Network tab of my inspector, I can see that some XHR requests to the Fastly module throws a 503 error which causes this problem.

    I can see 3 similar XHR requests, two of them work and one fails. The ones which work:

    • https://example.com/my-super-secret/admin/fastlyCdn_Vcl/getBackends/key/aabbccddeeff/?active_version=8
    • https://example.com/my-super-secret/admin/fastlyCdn_Edge_Acl/ListAll/key/aabbccddeeff/?active_version=8

    The one which fails with a 503 error:

    • https://example.com/my-super-secret/admin/fastlyCdn_Edge_Dictionary/ListAll/key/aabbccddeeff/?active_version=8

    And I also sometimes see this one fail with a 503 error:

    • https://example.com/my-super-secret/admin/fastlyCdn_Vcl/checkAuthDictionary/key/aabbccddeefff/?isAjax=true

    It's a bit random these errors, sometimes it's the first one, sometimes the other one, sometimes even both, and then sometimes no errors, really strange behavior.

    Looking at the actual contents of the response, we see something like this (it feels like this is a server error somehow, but no idea how to debug this):

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
      <head>
        <title>503 Service Unavailable</title>
      </head>
      <body>
        <h1>Error 503 Service Unavailable</h1>
        <p>Service Unavailable</p>
        <h3>Guru Mediation:</h3>
        <p>Details: cache-ams4432-AMS some-number some-other-number</p>
        <hr>
        <p>Varnish cache server</p>
      </body>
    </html>
    

    Extra info which might be relevant:

    • we have no Edge Dictionaries setup at the moment.
    • Magento 2.2.2
    • fastly/magento2 version 1.2.48

    Any ideas what can cause this or how we can solve this?

    If there are no errors, those request return valid looking json strings, so I don't think the problem is in the Fastly module itself, but actually on the server side. If we have to report this to the Magento Cloud support instead, please let us know.

    Thanks!

    opened by hostep 29
  • Magento Admin panel button issue

    Magento Admin panel button issue

    I cannot push any Fastly module setting buttons. There are buttons such as "Upload VCL to Fastly" or "Enable/Disable". But it doesn't work. Only "Test credentials" button seems working fine. Test result seems fine and I already purge cache. So I cannot complete installation Fastly for my site because of I cannot upload initial VCL snippets. I'm using Magento 2.3.4 OSS and latest Fastly_Cdn module. Can you resolve?

    Thank you.

    opened by hryksbt 12
  • Resizing issues with

    Resizing issues with "Enable Deep Image Optimization" on product list page

    Hi,

    We seeing this issue on our client's website when we set "Enable Deep Image Optimization" to Yes.

    image

    The issue does not happen when we use native Magento image resizing.

    image

    Running on 1.2.104.

    Thanks

    opened by sdesmet 10
  • Advanced -> System Page cannot be accessed with latest version of module and magento 2.2

    Advanced -> System Page cannot be accessed with latest version of module and magento 2.2

    1. Linux version 4.12.4-pl2 ([email protected]) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Sat, 29 Jul 2017 11:33:19 +0200
    2. PHP 7.0.23-1~dotdeb+8.1
    3. Mariadb 10.1
    4. magento 2.2 enterprise
    5. Composer version 1.5.0 2017-08-08 11:08:04
    6. The advanced -> system section is not accessible with the fastly module enabled. I have tested this without the fastly module disabled and it does work correctly. Screenshot of blank system page attached configuration settings stores magento admin

    Unfortunately I cannot find any error logs for this but I will keep looking

    opened by jordanvector 9
  • Magento 2.4.4 Commerce

    Magento 2.4.4 Commerce

    Hi, We are on magento 2.4.4 After every few min, we see that fastly is purging. We have made no changes that may invalidate those keys. How can we troubleshoot this further: [2022-09-01T18:36:13.808506+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: p99007"} [] [2022-09-01T18:36:13.808805+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: p99019"} [] [2022-09-01T18:36:13.808853+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: p87982"} [] [2022-09-01T18:36:13.808890+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: p87986"} [] [2022-09-01T18:36:13.808923+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: p99004"} [] [2022-09-01T18:36:13.808954+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: p99013"} [] [2022-09-01T18:36:13.808985+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: p99017"} [] [2022-09-01T18:36:13.809023+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c8"} [] [2022-09-01T18:36:13.809054+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c18"} [] [2022-09-01T18:36:13.809084+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c101"} [] [2022-09-01T18:36:13.809118+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c98"} [] [2022-09-01T18:36:13.809148+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c102"} [] [2022-09-01T18:36:13.809178+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c108"} [] [2022-09-01T18:36:13.809208+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c7"} [] [2022-09-01T18:36:13.809238+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c194"} [] [2022-09-01T18:36:13.809267+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c2"} [] [2022-09-01T18:36:13.809297+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":"surrogate key: c191"} [] [2022-09-01T18:36:13.818236+00:00] report.DEBUG: cache_invalidate: {"method":"GET","url":"http:/","invalidateInfo":{"tags":["cat_p_99007","cat_p_99019","cat_p_87982","cat_p_87986","cat_p_99004","cat_p_99013","cat_p_99017","cat_c_8","ca$

    opened by farrukhk 8
  • Magento 2.3 Support

    Magento 2.3 Support

    Preqs

    I am installing Fastly on version 2.3 and I don't believe they are compatible. I have configured the extension and the "Test Connection" button works.

    • Magento 2.3
    • Fastly Configured
    • API keys entered and test connection successful

    Expected Result

    • Click the "Automatic Upload & Service Activation" button for VCL snippets to be uploaded to Fastly.

    Actual Result

    • Button does nothing, no network activity, console errors or feedback

    Work Around

    For now, I just hardcoded the request parameters in the controller and executed in manually via CLI.

    <?php
    
    require __DIR__ . '/app/bootstrap.php';
    
    $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
    $objectManager = $bootstrap->getObjectManager();
    
    /** @var \Magento\Framework\App\State $state */
    $state = $objectManager->get(\Magento\Framework\App\State::class);
    $state->setAreaCode('frontend');
    
    /** @var \Fastly\Cdn\Controller\Adminhtml\FastlyCdn\Vcl\Upload $upload */
    $upload = $objectManager->create(\Fastly\Cdn\Controller\Adminhtml\FastlyCdn\Vcl\Upload::class);
    $upload->execute();
    
    opened by brideo 8
  • Please tag version 1.2.33

    Please tag version 1.2.33

    Hi all

    Magento starts showing notifications that version 1.2.33 is out, but running composer update doesn't find this new version yet. I think you guys forgot to tag a new version?

    Thanks!

    opened by hostep 8
  • Add missing observers for invalidating cache upon reindex

    Add missing observers for invalidating cache upon reindex

    Add two missing events that were causing cache invalidation not to be triggered.

    Example case would be saving category info with indexing mode set to 'on schedule' and 'flat tables' being turned on.

    opened by udovicic 8
  • Image Optimization not being applied for admin pages

    Image Optimization not being applied for admin pages

    We have noticed that Image Optimization is only applying for frontend request, and not on admin pages. For instance, admin product grid renders product images from the path media/catalog/product/cache, this has a huge impact on PHP servers which still have to manage get.php requests and generate Magento media cache files.

    opened by sivasdescalzo 7
  • Catalog list image optimization not working in Magento 2.3.x

    Catalog list image optimization not working in Magento 2.3.x

    Hello,

    I've noticed that catalog list image optimization are not working since Magento 2.3.x. I've tested this on latest version of Fastly module (1.2.103).

    Looking at code I see that Fastly specific URL queries are added via \Fastly\Cdn\Model\Product\Image using getUrl which in turn is an override for Magento\Catalog\Model\Product\Image.

    Problem is that in 2.3.x Magento\Catalog\Model\Product\Image is no longer used when generating catalog list images and image URL. Instead Magento\Catalog\Model\View\Asset\Image is used, which does not contain the Fastly image URL.

    If it helps, the change to the used image class in Magento 2 core code was introduced via this commit https://github.com/magento/magento2/commit/da7a64f2585ac534762235821db727f7af59f808

    opened by RicardsRikmanis 7
  • It is not possible to remove GraphQL modules

    It is not possible to remove GraphQL modules

    As with a lot of community members we remove the graphql modules as we are not actively using graphql. We do this for 2 reasons. 1. To remove the graphql endpoint itself, 2. to de-bloat the software as a whole.

    To do this we use the composer replace option. e.g.

    "replace": {
            "magento/module-graph-ql": "*",
            "magento/module-graph-ql-cache": "*"
    }
    

    After a composer install and setup:upgrade these modules will be removed but the fastly module will fail on set:di:compile as it cannot find the second parameter in the class Fastly\Cdn\Plugin\GraphQl\AfterRenderResult which is Magento\GraphQlCache\Model\CacheableQuery.

    It is not possible just to disable this plugin but instead we have had to remove the full class via a .patch file.

    In an ideal world there would be multiple modules for fastly one for the main system and one specific for graphql that we could then remove as well as the other graphql module.

    opened by dmanners 0
  • Expecting 404 on images that do no exist, but getting placeholder image instead

    Expecting 404 on images that do no exist, but getting placeholder image instead

    Prerequisites:

    Adobe Commerce 2.4-develop with Fastly least

    Steps to reproduce:

    • Enable Fastly deep image optimization. image
    • Access a random URL under the media directory. E.g /media/test.jpeg
    • Observe the 404 response code
    • Wait for 1 hour
    • Make the same request again
    • Observe 200 response code

    (on) Screen recording https://shared-assets.adobe.com/link/0b4964de-3838-4e40-5428-fe8eb1433d2d

    (x) Actual result:

    After 1 hour from the initial request, all the requests made to the media directory return the 200 status code with a placeholder image.

    (/) Expected result:

    None existing images should respond with the 404 status code.

    (i) extra details

    The default Adobe Commerce execution process gets interrupted when the deep image optimization is enabled. https://github.com/fastly/fastly-magento2/blob/master/Plugin/MediaStorage/App/AroundMedia.php#L67

    opened by kavingas 0
  • Fastly is not setting the converted cache tags

    Fastly is not setting the converted cache tags

    Issue description

    Fastly is not setting the converted cache tags, I've done some debugging and the culprit seems to be the ResponsePlugin and the identical operator here: https://github.com/fastly/fastly-magento2/blob/7701a623cfdf06f63fab6dfd6a361f84324fa858/Model/ResponsePlugin.php#L69 As you can see on the screenshot, the value returned by $this->config->getType() is string, and the Config::FASTLY is int. Because of this, it never sets the converted cache tags and the module is not able to clear the cache per tag.

    Steps to reproduce the issue

    1. Have Fastly configured
    2. Load a category page
    3. Check headers

    What's the expected result?

    • the X-Magento-Tags (or the Surrogate-Key) header contains the converted Magento tags instead of the original ones e.g. for category page: cat_c c505 cat_p p571041

    What's the actual result?

    • the X-Magento-Tags (or the Surrogate-Key) header contains the original Magento tags instead of the converted ones e.g. for category page: cat_c,cat_c_505,cat_p,cat_p_571041

    Additional details / screenshot

    Screenshot 2022-11-10 at 18 34 44

    I'm using Magento Commerce 2.4.2-p2 and the Fastly Magento module version 1.2.164.

    opened by laszloborzas 1
  • Custom VCL Snippet Syntax Errors. Unable to Change Type.

    Custom VCL Snippet Syntax Errors. Unable to Change Type.

    The admin Fastly FPC Custom VCL Snippets UI allows you to edit/modify an existing VCL's type even though it is unable to actually change the VCL's type after it has already been uploaded.

    For example,

    Lets say you've uploaded a recv type VCL snippet. image

    Later on, you've decided to change it's type. image

    clicking edit, the UI allows you to change/modify the vcl type even though it's not actually able to change a vcl type that has been uploaded.

    Doing so will cause syntax errors upon re-uploading the updated vcl snippet as it still thinks that it is the previous vcl's type. image

    Failed to validate service version: Variable `beresp.http.X-UA-Device not accessible in method `vcl_recv` .. in funtion `vcl_recv` ...which is the `vcl_recv` method at (input Line 21011 Pos 7) set beresp.http.X-UA-Device = "mobile"; ------########################------------
    

    This causes one to think there is something wrong with the syntax when in fact, the syntax is correct, just the type cannot be changed after a snippet has already been uploaded as a certain type.

    opened by mr-pmillz 0
Owner
Fastly
Fastly
A htaccess boilerplate for all Magento Community installations. Features focus on speed, SEO and security.

magento-htaccess A htaccess boilerplate for all Magento Community installations. Features focus on speed, SEO and security. The file should be placed

Creare 114 Sep 18, 2022
Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

LimeSoda Interactive Marketing GmbH 73 Apr 1, 2022
Rah backup - Takes backups from Textpattern CMS installations

rah_backup Packagist | Twitter | Donate Rah_backup keeps your important site safe from disastrous events. Rah_backup is an admin-side backup utility p

Jukka Svahn 5 Apr 24, 2022
Drall - a tool to that helps run drush commands on multi-site Drupal installations

Drall Drall is a tool to that helps run drush commands on multi-site Drupal installations. One command to drush them all. — Jigarius A big thanks and

Jigar Mehta 23 Nov 25, 2022
Magento 2 Module Experius Page Not Found 404. This module saves all 404 url to a database table

Magento 2 Module Experius Page Not Found 404 This module saves all 404 urls to a database table. Adds an admin grid with 404s It includes a count so y

Experius 28 Dec 9, 2022
Automatically load the next page of products in Magento. Easy to install and configure, this module works 100% out of the box with vanilla Magento 1.9.x and earlier.

Automatically load the next page of products in Magento. Easy to install and configure, this module works 100% out of the box with vanilla Magento 1.9.x and earlier.

Strategery 123 Nov 20, 2021
A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2

Simple Import / Export tool A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2. Table data

EcomDev B.V. 51 Dec 5, 2022
The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. All commands are extendable by a module API.

netz98 magerun CLI tools for Magento 2 The n98 magerun cli tools provides some handy tools to work with Magento from command line. Build Status Latest

netz98 758 Dec 28, 2022
Content Fuzzyfyr Module for Magento® 2

Content Fuzzyfyr Module for Magento® 2 The Content Fuzzyfyr module for Magento® 2 fills up empty content fields - and if needed - switches real conten

Hive Commerce 11 Oct 17, 2022
Magento 2 module to quickly acces products, orders and customer from admin menu

Magento 2 module to quickly access product, order or customer views Introduction The Magento 2 backend can be sluggish. Ever wanted to access a produc

null 1 Dec 3, 2021
Extract and evolution of the magento2-currency-precision module from the magento2-jp project from @Magento

Currency Precision Module for Magento 2 This module aims to help merchants to manage easily their currency precision in Magento 2. DISCLAIMER Initiall

OpenGento 3 Dec 17, 2021
New Ultimate Module Creator for Magento 1.7 +

Ultimate Module Creator 1.9.6.0 Notice Because of lack of time, motivation and because Magento2 is already a mature platform, I'm deciding to pull the

Marius Strajeru 247 Nov 22, 2022
Magento 2 Message Queue Open Source Module

Magento 2 Message Queue Module Lightweight implementation of message queue for Magento 2 Community Edition. System requirements This extension support

Renato 36 Sep 30, 2021
Magento 2 module for ngrok.io service support

Magento 2 ngrok Magento 2 module for ngrok service support. Automatically updates Magento base url based on domain used in the request. Modifies full-

Dmitry Shkoliar 46 Aug 26, 2022
Magento 2 Grid Colors module for colorizing admin grids. Supports saving of states with the help of grid's bookmarks.

Magento 2 Grid Colors Overview The module adds extra coloring features to admin grids at the Sales section. With help of this module, it is possible t

Dmitry Shkoliar 58 Dec 8, 2022
Magento 2 Email Catcher or Email Logger Module. Available At Packagist.

Magento 2 Module Experius email catcher / - logger ``experius/module-emailcatcher`` Main Functionalities Installation Versions Enable email catcher C

Experius 53 Dec 18, 2022
Magento 2 module to log to Sentry

Magento 2 Sentry Logger This Magento 2 module integrates the Sentry sdk into magento 2. Depending on the log level configured in the backend of magent

JustBetter 134 Dec 19, 2022