When using CodeKit as a reverse proxy in front of an Apache/PHP-FPM server, Safari hangs for ~30 seconds on every PHP response. Static HTML files load instantly.
Environment:
- CodeKit (latest)
- Apache 2.4 + PHP-FPM via proxy_fcgi
- Safari 26.0 (macOS)
Root cause:
Apache's proxy_fcgi module sends PHP responses with Transfer-Encoding: chunked because the response size is unknown at header time. CodeKit receives the chunked response, decodes it, injects its reload script, and then forwards it to the browser with both Transfer-Encoding: Identity and Content-Length set simultaneously.
This combination causes Safari to wait ~30 seconds before rendering. Chrome is unaffected.
Verified with mitmproxy between Safari and CodeKit:
First response byte: 23:19:11.188
Response complete: 23:19:41.190 ← 30 second gap
CodeKit receives the response immediately but holds the connection open for 30 seconds before closing it.
Reproduction:
- Set up Apache + PHP-FPM as external server in CodeKit
- Create
index.php with only echo "foo";
- Open via CodeKit preview URL in Safari
- Observe 30 second hang
Expected behavior: PHP responses should load as fast as HTML responses.
When using CodeKit as a reverse proxy in front of an Apache/PHP-FPM server, Safari hangs for ~30 seconds on every PHP response. Static HTML files load instantly.
Environment:
Root cause:
Apache's
proxy_fcgimodule sends PHP responses withTransfer-Encoding: chunkedbecause the response size is unknown at header time. CodeKit receives the chunked response, decodes it, injects its reload script, and then forwards it to the browser with bothTransfer-Encoding: IdentityandContent-Lengthset simultaneously.This combination causes Safari to wait ~30 seconds before rendering. Chrome is unaffected.
Verified with mitmproxy between Safari and CodeKit:
CodeKit receives the response immediately but holds the connection open for 30 seconds before closing it.
Reproduction:
index.phpwith onlyecho "foo";Expected behavior: PHP responses should load as fast as HTML responses.