# Shopware 6

This guide covers integrating smoxy with Shopware 6. It assumes you are using a current version of Shopware 6 — very old versions may not fully support all features described here.

{% hint style="info" %}
**Prerequisites:** Complete the [Getting Started](https://docs.smoxy.eu/en/getting-started) guide first. Your shop's domain must be routed through smoxy.
{% endhint %}

***

### Cache Tagging (Surrogate Keys)

Shopware 6 supports surrogate keys for efficient cache invalidation. When properly configured, Shopware tells smoxy exactly which cached pages need to be cleared when content changes — instead of flushing the entire cache.

#### Enable Reverse Proxy Mode

Edit `config/packages/storefront.yaml` (Shopware 6.6.0+) or `config/packages/shopware.yaml`:

```yaml
shopware:
    http_cache:
        reverse_proxy:
            enabled: true
            hosts: ["https://smoxy:<token>@example.com"]
            use_varnish_xkey: true
```

Replace `example.com` with your actual shop domain and `<token>` with the cache token from your site's Basic Configuration.

{% hint style="info" %}
**Note:** 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). Adjust your config when upgrading.
{% endhint %}

{% hint style="info" %}
**Cloudflare users:** If you use Cloudflare, you must set up a separate subdomain for cache invalidation. See [Cloudflare Setup](https://docs.smoxy.eu/en/developer-guide/broken-reference).
{% endhint %}

#### Optimize Cache Hit Rate

Reduce cache tag fragmentation by disabling per-item tags for config, snippets, and themes:

```yaml
shopware:
    cache:
        tagging:
            each_config: false
            each_snippet: false
            each_theme_config: false
```

This reduces the number of tags written per page, which leads to fewer unnecessary cache invalidations and a higher cache hit rate.

***

### Multiple Sales Channels

If your Shopware 6 installation uses multiple sales channels with different domains (e.g. country-specific shops), you only need to configure **one domain** in the reverse proxy `hosts` setting. Shopware knows which caches to clear for which sales channel and transmits this information to smoxy automatically.

{% hint style="warning" %}
**Important:** All sales channels of the same Shopware installation must use the same smoxy site.
{% endhint %}
