504 Gateway Timeout

If your cronjob always returns HTTP status code 504 Gateway Timeout after an exact time like 60 seconds or 120 seconds, then that means there's a timeout limit in your web server settings.

Generally, it happens when the web server and server-side script processes are separate, e.g. Nginx and PHP-FPM, or Kestrel/IIS and ASP.NET, and the server-side script are taking too long to execute and return the output, the web server will time out and return the HTTP status 504 back to the browser.

There are some ways to resolve the issue:

  • Increase the web server's timeout limit to a bigger value, up to the server-side script's max execution time. For example, increase Nginx's fastcgi_read_timeout to the same value as PHP's max_execution_time.

  • Decrease the server-side script's execution time, e.g. by limiting the number of items processed per execution.

  • Make the server-side script continue to execute even when the web server stops waiting for it, e.g. enable PHP's ignore_user_abort.


Need help? Reach out to support@fastcron.com - we're happy to help.

Ready for better cronjobs?

See why 8,000+ website developers and their teams use FastCron to run their cronjobs 12 million times a day.

Start 14-day free trial

FastCron

The reliable online cronjob service for your websites since 2009.


© 2009 - 2026 FastCron · All rights reserved · Terms of service · Privacy policy · Website monitored by Cahook · Status