From 2870d45bdc51f5f7841cc5d0b4ca61babef462d5 Mon Sep 17 00:00:00 2001 From: Josh Knapp Date: Fri, 26 Dec 2025 15:29:56 -0800 Subject: [PATCH] Add Apache ProxyTimeout configuration for SSE support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created apache-sse-config.conf with required Apache settings to support long-running SSE connections. Apache's mod_proxy_fcgi has a default timeout of 30-60 seconds which kills SSE connections prematurely. The configuration sets ProxyTimeout to 21600 seconds (6 hours) to match HAProxy's timeout and allow long streaming sessions. Added note to .htaccess explaining this requirement, as ProxyTimeout cannot be set in .htaccess and must be configured in the virtual host. To fix 504 Gateway Timeout errors: 1. Add ProxyTimeout directive to Apache virtual host config 2. Reload Apache 3. Test SSE connection 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- server/php/.htaccess | 5 +++++ server/php/apache-sse-config.conf | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 server/php/apache-sse-config.conf diff --git a/server/php/.htaccess b/server/php/.htaccess index 709dee9..2c6d509 100644 --- a/server/php/.htaccess +++ b/server/php/.htaccess @@ -1,6 +1,11 @@ # Security settings for Multi-User Transcription Server # Compatible with both mod_php and php-fpm +# IMPORTANT: For Server-Sent Events (SSE) to work with php-fpm, you MUST configure +# Apache's ProxyTimeout in your virtual host configuration. See apache-sse-config.conf +# for the required settings. Without this, Apache will timeout SSE connections after +# 30-60 seconds with a 504 Gateway Timeout error. + # Deny access to config file directly (if accessed via URL) Require all denied diff --git a/server/php/apache-sse-config.conf b/server/php/apache-sse-config.conf new file mode 100644 index 0000000..e1f18e5 --- /dev/null +++ b/server/php/apache-sse-config.conf @@ -0,0 +1,20 @@ +# Apache configuration snippet for Server-Sent Events (SSE) support +# Add this to your Apache virtual host configuration +# +# Location: Typically in /etc/apache2/sites-available/your-site.conf +# or wherever your virtual host is configured + +# Increase timeout for SSE connections (6 hours to match HAProxy) +# This prevents Apache from killing long-running SSE connections +ProxyTimeout 21600 + +# Alternative: Set timeout specifically for SSE endpoints +# Uncomment and adjust the path if you want to be more specific +# +# ProxyTimeout 21600 +# + +# Note: After adding this to your virtual host config, reload Apache: +# sudo systemctl reload apache2 +# or +# sudo service apache2 reload