Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apache 2.4.55, mod_http2 v2.0.11 : Connection not closed anymore, when backend are disconnected #244

Open
EIP-Laurent opened this issue Feb 3, 2023 · 0 comments

Comments

@EIP-Laurent
Copy link

Hello

Since the apache version 2.4.55

using mod_proxy_fcgi with php-fpm and mod_http2

If I do a curl --http2 https://url/sse.php when the php-fpm is restarted the proxy_fcgi is receiving the connection reset, but the connection to the curl are not closed.

If I use http/1.1, the connection with the curl are correctly closed.

Sample httpd.conf

Listen 443

LoadModule mpm_event_module modules/mod_mpm_event.so

LoadModule http2_module modules/mod_http2.so
Protocols h2 h2c http/1.1

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule ssl_module modules/mod_ssl.so

DirectoryIndex index.php index.html
<FilesMatch \.php$>
#    SetHandler "proxy:unix:/run/php-fpm/php-fpm.sock|fcgi://localhost/"
    SetHandler "proxy:unix:/run/php-fpm-legacy/php-fpm.sock|fcgi://localhost/"
</FilesMatch>
<Proxy "fcgi://localhost" enablereuse=off flushpackets=on timeout=300>
</Proxy>

<VirtualHost *:443>
   DocumentRoot /srv/http
   SSLEngine on
   SSLHonorCipherOrder off
   SSLCertificateFile /data/ssl/host.crt
   SSLCertificateKeyFile /data/ssl/host.key
   SSLOpenSSLConfCmd DHParameters /data1/ssl/dhparams.pem
   SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
</VirtualHost>

Sample sse.php

<?php

ini_set('session.use_cookies',false);
session_cache_limiter(false);
session_start();

header("Content-Type: text/event-stream");
header("Cache-Control: no-cache");
header("Access-Control-Allow-Origin: *");

function sendMsg($id, $msg) {
  echo "id: $id" . PHP_EOL;
  echo "data: $msg" . PHP_EOL;
  echo PHP_EOL;
  ob_flush();
  flush();
}

while (1) {
      $serverTime = time();
      sendMsg($serverTime, 'server time: ' . date("h:i:s", time()));
      sleep(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant