Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Sulu Http Cache Bundle

Sulu Http Cache Bundle Laravel Package

alengo/sulu-http-cache-bundle

View on GitHub
Deep Wiki
Context7

HTTP cache helpers for Sulu/Symfony: strip tracking query parameters and store CTA marketing-attribution cookies at the reverse-proxy layer.

Frequently asked questions about Sulu Http Cache Bundle
How does this bundle help with Sulu CMS caching performance?
The bundle strips tracking query parameters (like UTM tags) from cached responses, preventing cache pollution. It also offloads marketing-attribution cookies to the reverse proxy (Varnish/Nginx), reducing payload size and improving cache efficiency. This leads to faster page loads and lower server resource usage.
Does this work with Sulu’s built-in HTTP caching or Varnish?
Yes, it integrates seamlessly with Symfony’s HTTP cache layer (e.g., HttpCache middleware) and reverse proxies like Varnish or Nginx. The bundle assumes you’re already using a proxy for caching, as it handles cookie management at that layer for optimal performance.
What Laravel versions or Symfony-based apps can use this?
This bundle is specifically for Symfony 6.4+ applications, including Sulu CMS. It won’t work with Laravel or non-Symfony stacks. If you’re using vanilla Symfony (not Sulu), it can still work, but Sulu-specific features won’t apply.
How do I configure it to strip specific tracking parameters?
Add the bundle to `config/bundles.php` and define your tracking parameters in `config/packages/sulu_http_cache.yaml` under `tracking_params`. For example, `tracking_params: ['utm_source', 'utm_medium', 'campaign']` will strip these from cached responses automatically.
Can I use this without a reverse proxy like Varnish?
The bundle assumes a reverse proxy for handling cookies at the edge. Without Varnish/Nginx, cookie management falls back to the application layer, which may reduce performance benefits. If you lack a proxy, consider alternatives like Symfony’s built-in cache headers.
Will this break existing cache tags or ESI includes in Sulu?
The bundle strips query parameters *after* caching, so it shouldn’t affect cache tags or ESI fragments directly. However, test thoroughly with your existing cache strategy to ensure stripped params don’t interfere with dynamic content like ESI includes.
How do I handle GDPR-compliant cookie management with this?
The bundle lets you define which cookies (e.g., `_ga`, `marketing_attribution`) to manage at the proxy layer. Ensure these cookies comply with GDPR/CCPA by configuring their scope, expiration, and consent requirements in your proxy rules (e.g., Varnish VCL).
What if my proxy fails to handle cookies? Does it degrade gracefully?
The bundle includes fallback logic. If the proxy fails to inject or strip cookies, the application layer will handle them as usual, though performance may degrade. Monitor proxy health and implement alerts for such failures.
How do I test this bundle in a Sulu environment?
Start with unit tests for the `SuluHttpCacheEventSubscriber` to verify query param stripping. Use tools like `curl` or `varnishlog` to inspect proxy behavior. For end-to-end testing, simulate cached responses and check if tracking params are stripped and cookies are handled correctly.
Are there alternatives for Symfony apps without a reverse proxy?
If you lack a reverse proxy, consider Symfony’s built-in `HttpCache` middleware or libraries like `symfony/http-cache` to manage headers and cookies at the application level. However, these won’t offer the same edge-caching performance as a proxy-based solution.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky