Skip to content

php-fpm fail to process uris above 32kb in length #12982

@divinity76

Description

@divinity76

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions