Closed Justin-Maxwell closed 6 years ago
I may have posted too soon. My problem is back. I will update when I've rechecked.
'connection: keep-alive' makes more sense, but shouldn't the proxy still close the connection once the transfer is Status=200, so the client can get the content and get on with retrieving the other page assets etc? I'm new to working with HTTP at this level...
UPDATED:
First, this probably isn't directly php-proxy, but downstream, but I'm a novice in these PHP PSR-7 parts...
Using the README boilerplate code, I was getting extremely slow responses from
$proxy->to()
.15 seconds, for
http://example.com
, several minutes for longer pages. I could see (using charles) that the remote server was returning with status=200 in milliseconds.Via XDebug profiling (there's nothing like something that makes no sense to mandate learning new tools!) I could see that it gets tied up in fread. I've attached a screenshot, not sure if any use though.
So, anyhow, after a ton of isolating things, and progressively eliminating bits out of
::fromGlobals()
, I eventually found that it seems to be theconnection: keep-alive
header being passed along from the client.'accept-encoding' => 'gzip, deflate, sdch',
passed through from my client still seems to have some impact, but it's inconsistent and confusing.keep-alive
at least makes sense, and behaves (so far) consistently.Using almost the stock README example (see below), but modifying the line near the top to:
Makes everything zippy, (if no longer gzippy [anachronistic humour fail])
XDebug/cachegrind profile