php-fpm fail to process uris above 32kb in length
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Assuming php-fpm and nginx configured to allow large URLs ( http{ large_client_header_buffers 8 999k; ...} )
The following code:
<?php
$url = "http://localhost/?a=" . str_repeat("a", 33*1024);
$ch = curl_init($url);
curl_exec($ch);
Resulted in
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.22.1</center>
</body>
</html>
and /var/log/nginx/error.log containing
2023/12/20 06:15:30 [error] 7980#7980: *32033 writev() failed (32: Broken pipe) while sending request to upstream, client: 162.248.164.115, server: localhost, request: "GET /?a=aaaaaaaaaa(...)
and nothing in /var/log/php8.2-fpm.log
But I expected... a notice in the php-fpm log that something went wrong? and maybe a HTTP 414 Request-URL too long error instead of a 502 Bad Gateway ?
PHP Version
PHP 8.2.7
Operating System
Debian 12
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the 33 KB URI with PHP 8.2.7, php-fpm, and the stated nginx buffer configuration. Trace how php-fpm and nginx handle the oversized request and review the reported nginx and php-fpm logs; done means the failure is handled and reported with an appropriate response rather than an unexplained 502.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nginx, php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100