pulpmedia/p3pcookiebundle
Legacy Symfony bundle that adds P3P (Platform for Privacy Preferences) headers to cookies, helping older Internet Explorer accept third-party cookies. Useful for maintaining compatibility with deprecated browser privacy policies.
composer require. This is a Symfony2 bundle, not a Laravel package. There is no service provider, no facade, no Illuminate dependency. Dropping it into a Laravel app will either fail on symfony/symfony ~2.x constraints or pull in an EOL subtree. Decide up front: you are reading this repo for the technique, not installing it.Resources/config/services.xml (what gets registered), the event listener class (where the header is actually written), and DependencyInjection/Configuration.php (the configurable knobs). That trio is the entire package.P3P: CP="NOI DSP COR NID ADMa OUR IND UNI COM NAV". The bundle attaches that header to responses so session cookies survive in embedded contexts.// app/Http/Middleware/P3pHeader.php
public function handle($request, Closure $next)
{
$response = $next($request);
$response->headers->set('P3P', 'CP="NOI DSP COR NID ADMa OUR IND UNI COM NAV"');
return $response;
}
Register it in app/Http/Kernel.php — globally for an embed-heavy app, or as a route middleware alias so you only pay for it where it matters.
kernel.response. The Laravel analogue is middleware. Keep the compact-policy string in config/p3p.php (or config/services.php) so ops can change it without a code deploy.'p3p') and attach it to embed/iframe routes only — the moral equivalent of tagging the Symfony listener to specific paths. Global middleware puts a dead-standard header on every JSON, asset, and API response.config('p3p.compact_policy') and validate the string once at boot. A malformed CP token is silently ignored by IE, which is the worst possible failure mode.SameSite=None; Secure — set in config/session.php ('same_site' => 'none', 'secure' => true) or per-cookie on the Cookie facade. Ship both, or your embed works only in IE and nowhere else.$this->get('/embed')->assertHeader('P3P') in a feature test, and an assertion that non-embed routes do not carry the header, so a future "just make it global" refactor gets caught in CI.curl -I against the CDN hostname.kernel.response listener at higher priority. If you maintain a hybrid Symfony/Laravel estate, that's where you'd hook rather than editing vendor code.Bundle classes, and services.xml. Composer refuses or drags in an EOL Symfony 2.x tree. Treat the repo as reference source only.composer.json "just in case."SameSite=None; Secure plus a first-party or partitioned-cookie strategy.P3P: CP="..." shape, comma-separated tokens, and it fails closed and silently on typos. Copy a known-good CP string verbatim; don't hand-assemble tokens.add_header P3P ...) set it, you can end up with two values and IE may ignore both. Pick one layer and remove the other.curl -sI https://app/embed | grep -i p3p, then DevTools → Network → Response Headers. If it's missing, check middleware ordering in Kernel::$middleware and whether an earlier middleware short-circuits without calling $next.SameSite/Secure (everyone else) are the only levers you control from the origin.database or redis sessions and a dropped cookie, you don't get an error — you get a fresh session per request and phantom logged-out users. Log session()->getId() on embed routes while debugging; a changing ID confirms the cookie is the problem, not auth.php artisan config:clear in your deploy script.How can I help you explore Laravel packages today?