Is there a difference between what headers php returns and what is set in nginx?

When I run:

curl -I mydomain.com

I get as expected (I have keep-alive off)

Connection: close

But when I output the $_SERVER[HTTP_CONNECTION] on that same domain I get:

Connection: keep-alive

I am not sure why php is returning keep-alive where everywhere else I pull the headers and it shows connection closed.

1 Answer 1


$_SERVER[HTTP_CONNECTION] in PHP contains Connection header from client's request, telling the server that client supports keep-alive.

What you see with cURL's output, is the response from server, telling that connection will be closed instead of kept open for keep-alive.

  • 1
    I thought I read that somewhere but the problem is I go to another site hosted that is hosted via GoDaddy and in the same browser and it shows Connection: close as the PHP variable.
    – jrodichok
    Dec 22, 2015 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .