Skip to content

Commit 4056517

Browse files
authored
Set Vary: Accept header for all responses (#398)
1 parent 16412da commit 4056517

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/Middleware.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public function handle(Request $request, Closure $next)
8787

8888
$response = $next($request);
8989

90+
$response->header('Vary', 'Accept');
91+
9092
if (! $request->header('X-Inertia')) {
9193
return $response;
9294
}

src/Response.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ public function toResponse($request)
104104
];
105105

106106
if ($request->header('X-Inertia')) {
107-
return new JsonResponse($page, 200, [
108-
'Vary' => 'Accept',
109-
'X-Inertia' => 'true',
110-
]);
107+
return new JsonResponse($page, 200, ['X-Inertia' => 'true']);
111108
}
112109

113110
return ResponseFactory::view($this->rootView, $this->viewData + ['page' => $page]);

0 commit comments

Comments
 (0)