Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages

Help for owners

My website says 504 Gateway Timeout

Short answer

A 504 Gateway Timeout means the server in front of your site waited for the application behind it and got no answer in time. The cause is a slow or overloaded application, a heavy request, or a database that is struggling. It needs someone to read the logs, not a guess.

  • Written for business owners
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Does this sound like your situation?

  • The page loads for a long time and then shows 504.
  • Only some pages, such as reports or checkout, fail.
  • The site gets slow before it fails.
  • It is worse at busy hours.

Why does this happen?

  1. The application took too long

    MDN describes a 504 as a gateway or proxy not getting a response in time from the upstream server. Usually that means the code is busy or stuck on a slow request.

  2. A heavy page or job runs inside a normal request

    Exports, reports, imports and large image processing can run longer than the front server will wait.

  3. The database is slow

    If the database behind the site is slow or locked, the application waits for it and the front server gives up.

  4. A time limit is set too low

    Web servers and hosting platforms set their own time limits. A page that needs longer than the limit will always time out.

What can I do about it today?

  1. Note which pages failDoes the whole site time out or only certain pages? Write down the addresses.
  2. Check from another networkThe same page that defines 504 says client network, VPN or DNS issues can cause it, so test on mobile data or ask a colleague.
  3. Do not repeat a payment or an orderIf the failing page submits an order or payment, do not click again and again. Check first whether it went through.
  4. Wait a short while and try onceThe page says the site may work again later, but a repeating 504 needs investigation.
  5. Report it with timesSend your developer or host the time of the error, the page and what you were doing.

When should I bring someone in?

  • The 504 repeats every day at the same hours.
  • Checkout or booking pages fail.
  • The site is slow even when it is not showing errors.

How do I handle it?

  1. Look at the logs firstI read the web server and application logs for the exact minute the problem started, before I change anything.
  2. Take a backupBefore a production change I take a backup and note how to go back.
  3. Fix the proven causeI change one thing, then test it from outside, the way a visitor would.
  4. Add the early warningI set up a check that tells you when it starts again, so you hear about it before your customers do, and write down what happened.

The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.

What do owners ask about this?

Can I just raise the time limit?

Sometimes it is part of the answer, but a longer wait hides a slow request. I find out why it is slow first.

Is a 504 caused by too much traffic?

It can be. A slow application under load is one of several causes, and the logs show which.

Will it go away by itself?

Sometimes it does, according to MDN, but if it returns it will keep costing you visitors until the cause is fixed.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.

For your developer: the technical fixes

Next step

Want this off your desk?

Send me a few lines on where things stand. I reply within 24 hours.