Why am I getting an Apache Proxy 503 error?

后端 未结 6 643
眼角桃花
眼角桃花 2021-01-30 05:12

My server was doing just fine up until yesterday. It was running Redmine, and it was the happiest little server until my \"friend\" imported a SQL table that my

6条回答
  •  猫巷女王i
    2021-01-30 05:54

    Apache will respond with 503's for at least 60 seconds any time it detects that the backend server is down. This is the default behavior. As in your example, if you restart your backend server (Rails in this example) and someone tries to access it through the Apache proxy before Rails is ready then Apache will return 503's for the next 60 seconds regardless if your backend is now 'up'. Please see the apache docs on ProxyPass where it states:

    retry 60

    Connection pool worker retry timeout in seconds. If the connection pool worker to the backend server is in the error state, Apache will not forward any requests to that server until the timeout expires. This enables to shut down the backend server for maintenance, and bring it back online later. A value of 0 means always retry workers in an error state with no timeout.

    So if you set your Proxy Pass to include retry=0 you won't see the 503's when you restart your backend service. This is also useful when using Apache as reverse proxy during development! For example:

    ProxyPass / http://localhost:8000 retry=0

提交回复
热议问题