jalik / proxy-timeout-error

Proxy timeout error demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proxy Timeout Error

This error can have multiple causes, but it always happens when an application behind a reverse proxy is not responding fast enough, so the proxy closes the connection and returns a 502 HTTP error.

How to start the demo

Run the following command to start the containers:

./compose-up.sh

Below are the URLs corresponding to each service:

Don't forget to stop the demo when you are done, with:

./compose-down.sh

How to trigger the timeout

  1. Go to http://localhost:8000/ and refresh several times, errors are randomly returned when accessing through the proxy
  2. Go to http://localhost:8080/ and refresh several times, there are no errors when accessing the application directly

Explanation

The reverse proxy is setup to close connection if it lasts more than one second. But on the application, some requests take more than a second to return, so the proxy close the connection and returns a 502 HTTP error.

How to fix the error

It depends of the root cause, but here are some non-exhaustive fixes:

  • Investigate why the responses are slow to return, and fix them if possible
  • Add more hardware resources to handle requests faster
  • Increase proxy timeout to wait longer

About

Proxy timeout error demo


Languages

Language:JavaScript 48.7%Language:Shell 29.8%Language:Dockerfile 21.5%