Skip to content

Commit f1ea505

Browse files
author
Tom Schlick
committed
don't use push for ajax requests
1 parent b4f2300 commit f1ea505

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Http2ServerPushMiddleware.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function handle(Request $request, Closure $next)
2222
{
2323
$this->response = $next($request);
2424

25-
if ($this->shouldUseServerPush()) {
25+
if ($this->shouldUseServerPush($request)) {
2626
$this->addServerPushHeaders();
2727
}
2828

@@ -38,10 +38,11 @@ protected function addServerPushHeaders()
3838
}
3939

4040
/**
41+
* @param Request $request
4142
* @return bool
4243
*/
43-
protected function shouldUseServerPush() : bool
44+
protected function shouldUseServerPush(Request $request) : bool
4445
{
45-
return true;
46+
return (! $request->ajax());
4647
}
4748
}

0 commit comments

Comments
 (0)