Users click Submit on a Gravity Forms form, the spinner runs for 20–60 seconds, then the browser shows a 502. Sometimes it succeeds on a second attempt. The submission has often partially completed — the entry is in the database, but the confirmation page never renders and the user retries, creating duplicates.
What’s actually happening
A Gravity Forms submission is rarely “just inserting a row.” Most production forms run notifications, third-party API calls (Mailchimp, HubSpot, Salesforce, Stripe), and file processing inside the same PHP-FPM request. When any of those calls hang — DNS timeout, a slow vendor endpoint, an unbounded HTTP retry — the worker holds the request open past the proxy’s upstream timeout. The 502 is the proxy giving up. The user sees a failure even though the form often succeeded.
How to verify
Look for slow Gravity Forms POSTs in the access log, ordered by request duration:
awk '$7 ~ /gravityformsajax/ && $7 ~ /POST/ {print $NF, $7}' /var/log/nginx/access.log \
| sort -nr | head -20
On LiteSpeed, check /usr/local/lsws/logs/error.log for Backend connection timeout against the PHP handler.
Then dump in-flight workers during the next slow submission:
SCRIPT_NAME=/admin-ajax.php /usr/local/cpanel/3rdparty/bin/php-fpm -t
ps -eo pid,etime,cmd | grep php-fpm | sort -k2 -r | head
Long-lived workers (over a minute) holding admin-ajax.php are the smoking gun.
The fix
- Increase the proxy upstream timeout to match the slowest legitimate submission (typically 60–90 seconds for forms with payment gateways) — but only as a stopgap.
- Move the slow work out of the request. Use a background job runner (Action Scheduler, which Gravity Forms 2.6+ supports natively for some feeds) so notifications and third-party calls run after the response is returned.
- Set explicit timeouts on every outbound HTTP call. WordPress’s default
wp_remote_posttimeout of 5 seconds is fine; vendor add-ons routinely override it to 30. Auditwp_remote_*calls in active form add-ons. - Cap PHP
max_execution_timelower than the proxy timeout so a runaway worker dies cleanly instead of producing a 502.
The right structural fix is asynchronous feeds. The 502 stops, retries stop, duplicate entries stop.
If this is happening on a revenue form, Stack Harbor’s Enterprise WordPress operating model includes form-pipeline instrumentation as part of standard onboarding.