codeGEN
codeGEN

Reputation: 714

Duplicate Connection:keep-alive, Keep-Alive

I am using PageSpeed Insights for Chrome to test my webpage & it suggest that I should enable Connection keep-alive. Although the headers in apache were set by default to Keep Alive I manually set them using my .htaccess file using the code below.

<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>

And now when I check the response header of each & every resource from the chrome dev tools the response header contains Connection:keep-alive, Keep-Alive. The keep alive is repeated twice, how do I prevent this from happening. A .htaccess solution is required because I don't have access to the apache or php setup files.

Upvotes: 0

Views: 776

Answers (1)

Nicocube
Nicocube

Reputation: 2992

According to the Apache Module mod_headers doc, example 6 :

Set the same header value under multiple nonexclusive conditions, but do not duplicate the value in the final header. If all of the following conditions applied to a request (i.e., if the CGI, NO_CACHE and NO_STORE environment variables all existed for the request):

Header merge Cache-Control no-cache env=CGI
Header merge Cache-Control no-cache env=NO_CACHE
Header merge Cache-Control no-store env=NO_STORE

then the response would contain the following header:

Cache-Control: no-cache, no-store

If append was used instead of merge, then the response would contain the following header:

Cache-Control: no-cache, no-cache, no-store

I hope this can help.

Upvotes: -1

Related Questions