Skip to content

Commit

Permalink
[4.x] Add Vary: X-Requested-With header to CP responses (#10016)
Browse files Browse the repository at this point in the history
Co-authored-by: duncanmcclean <duncanmcclean@users.noreply.github.com>
  • Loading branch information
duncanmcclean and duncanmcclean authored May 7, 2024
1 parent 51e2efb commit e94487b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Http/Middleware/CP/AddVaryHeaderToResponse.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Statamic\Http\Middleware\CP;

use Closure;

class AddVaryHeaderToResponse
{
public function handle($request, Closure $next)
{
$response = $next($request);

$response->headers->set('Vary', 'X-Requested-With');

return $response;
}
}
1 change: 1 addition & 0 deletions src/Providers/CpServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ protected function registerMiddlewareGroups()
\Statamic\Http\Middleware\CP\BootPreferences::class,
\Statamic\Http\Middleware\CP\BootUtilities::class,
\Statamic\Http\Middleware\CP\CountUsers::class,
\Statamic\Http\Middleware\CP\AddVaryHeaderToResponse::class,
\Statamic\Http\Middleware\DeleteTemporaryFileUploads::class,
]);
}
Expand Down

0 comments on commit e94487b

Please sign in to comment.