Skip to content
  • GDPR-compliant
  • 100% hosting in Germany
  • Personal contact
  • Support included
  • Provisioning within 24 hours
Error & Status Codes 2 min read

HTTP status code 504 Gateway Timeout: causes and solutions

In short

A 504 Gateway Timeout means: an intermediary server waited too long for a response and aborted the request. The page is not broken - a process behind it simply takes too long.

What does status code 504 mean?

As with 502, a web server, proxy or CDN is involved as an intermediary. With 504, however, the application server's response is not faulty but too late: the waiting time ran out before the script had finished.

Typical causes

  • Compute-intensive scripts, such as imports, exports or generating many images
  • Slow database queries, for example on large tables without suitable indexes
  • External services your site queries that respond slowly themselves - interfaces, payment or shipping services
  • Heavy background tasks that run along with a normal page view - such as WP-Cron in WordPress
  • With an upstream proxy or CDN: a shorter waiting time there than on the server

Solution for visitors

  • Reload the page after a moment.
  • If the error occurs during a specific action, such as submitting a form, check whether the action was carried out after all before trying again.
  • Let the operator know if the error occurs repeatedly.

Solution for site operators

  • Find the slow process: which address is affected, and does it always happen or only occasionally? The access and error logs help with this (reading log files).
  • Move long tasks elsewhere: run imports, exports, newsletters or reports via cron job or SSH instead of in the browser. In WordPress, replace WP-Cron with a real cron job.
  • Optimise the database: clean up clutter such as revisions or expired entries and check slow queries from plugins.
  • Safeguard external services: set short time limits for interface calls and cache their responses.
  • Use caching: a page cache and - from the Premium plan upwards on request - Redis as an object cache significantly shorten response times. With ShieldCache, pages are served straight from the Varnish cache, and our CDN delivers static files from locations close to your visitors.
  • Check the PHP time limit: you can adjust individual settings such as max_execution_time with your own php.ini. However, this does not remove the cause - the page only becomes faster through the optimisation itself.

Was this article helpful?

New to SpeedIT Solutions?

Hosting where you know someone.

What you are reading here is what we put into practice for our customers every day. Based in Isernhagen since 2009 - with dedicated contact persons rather than a call centre.

  • 100% hosted in Germany
  • GDPR-compliant
  • Dedicated contact person
  • Provisioning within 24 hours
4.9 88 reviews on Expeero

Top webhoster

Auf der Suche nach einem webhoster mit guten Leistungen und moderaten Preisen bin ich auf SpeedIT gestoßen. Von der ersten Minute an bin ich sehr zufrieden und kann nur sagen: einfach top webhoster!
Aziz I.Recommends us · 08/06/2026

100 % recommend us · Expeero

All reviews on HOSTtest (opens in a new window)

You might also be interested in:

Personal support

Of course, our support team is also happy to assist you personally. If you cannot find what you are looking for in our knowledge base or require personalised support, please do not hesitate to contact us. We’re here to help you and to ensure that your experience with our products and services is as smooth and enjoyable as possible.