Shopware 6
Last updated
Last updated
Integrating smoxy with Shopware 6 allows you to significantly improve the loading times of your online shop and optimize the user experience. By activating the Cache-Control headers in smoxy, it can automatically control which content should be cached by smoxy. This approach simplifies the caching strategy, as Shopware itself determines which contents are to be cached and which are not.
Before diving into the details of integrating smoxy into your Shopware 6 environment, we want to emphasize that this guide assumes you are using a current version of Shopware 6. The continuous development of Shopware ensures that new versions offer improved features and optimized performance. It is therefore important to note that using very old versions of Shopware 6 may lead to unexpected errors, as not all functionalities may be fully supported.
Before making changes to your Shopware configuration, it is important to activate the Cache-Control function in smoxy. This setting allows smoxy to recognize the Cache-Control headers of your website and act accordingly.
Log in to your smoxy dashboard.
Navigate to the site you want to configure by clicking on the name of your site.
Go to "General Settings" and then to "Configurations."
Activate the "Cache Control" setting here. This instructs smoxy to pay attention to the Cache-Control headers of your website and to control caching based on these headers.
After activating this setting in smoxy, you can proceed with configuring your Shopware 6 installation.
To activate the Cache-Control headers, adjust the configuration in the config/packages/storefront.yaml
file of your Shopware installation as follows:
The configuration key changed from storefront.reverse_proxy
up to Shopware 6.5.x to shopware.http_cache.reverse_proxy
starting with Shopware 6.6.0.0. So you will need to adjust your config while upgrading. If you look for the old documentation and examples, you can find it here
Replace example.com
with your actual shop domain that uses smoxy. Replace <Token>
with the specific token found in the site configuration in your smoxy dashboard.
Caution! Cloudflare
If Cloudflare is used, a separate subdomain for smoxy cache invalidation must be set up! More information is available under the section on BAN & Purge Requests through Cloudflare.
My Shopware 6 Installation Uses Multiple Sales Channels with Different Domains. How Should I Handle This?
Only one domain of the Shopware 6 installation is necessary. For example, if multiple country shops are deployed, which issue URLs in different languages, Shopware 6 knows by itself which cache needs to be cleared for which pages of the language shops and transmits this information to smoxy.
It is important that the same site in smoxy is used for all sales channels in the Shopware 6 installation. This setting activates support for reverse proxy and the use of surrogate keys for efficient caching.
shopware.yaml
in Shopware 6To improve the cache hit rate in Shopware 6, you can adjust the configuration in the YAML files located under config/packages/shopware.yaml
. Add the following lines:
These settings reduce the number of tags written, optimizing the cache hit rate. By disabling individual tags for configurations, snippets, and theme configurations, the cache becomes less fragmented.
Activate the HTTP cache and configure the Trusted Proxies at the same time in your .env
file to ensure efficiency and security:
SHOPWARE_HTTP_CACHE_ENABLED=1 activates the HTTP cache of Shopware.
TRUSTED_PROXIES should not only include the direct IP address of your server (SERVER_IP) but can also encompass a network range (NETWORK_RANGE). This is especially useful if your Shopware server operates within a specific network or you wish to allow requests from a secure internal network.
Example for Defining a Network Range:
Here, 10.0.0.0/24
is given as an example of a network range that includes all IP addresses from 10.0.0.1
to 10.0.0.254
. Make sure you adjust the network range according to your server configuration and security requirements.
By smartly connecting smoxy and Shopware 6, you've just taken a significant step towards optimizing your website – with astonishing simplicity! Activating the Cache Control function in smoxy allows you to master a challenging and often complex issue such as cache handling and developing an effective caching strategy with just one click. This simple action unleashes the power of Shopware's Cache-Control headers, ensuring automated, intelligent caching of your content. This means not only a significant time saving for you but also a considerable increase in website performance and user satisfaction.
By precisely configuring the Trusted Proxies, including specific IP addresses and network ranges, you ensure efficient processing of requests. Thus, you not only achieve peak performance in website speed but also strengthen the security of your online presence.