Overview
When accessing Webmail, you might get the following Proxy Error message.
504: Request Denied
upstream timed out (60: Operation timed out) while reading response header from upstream, client: x.x.x.x, server: mail.domain.com, request: "POST /webmail/api/jsonrpc/ HTTP/2.0", upstream: "http://10.10.20.12:8800/webmail/api/jsonrpc/", host: "mail.domain.com", referrer: "https://mail.domain.com/webmail/"
The issue happens in very specific cases, namely, when there is a proxy sitting in front of Kerio Connect (Nginx, pfSense, OpnSense).
Solution
The issue lies in the configuration of the proxy server, and can be resolved by configuring the timeout values in the proxy. Here are the steps to follow:
- For standard nginx, set the
proxy_read_timeout
to 999999. - If you are using other proxy servers, you will need to consult the vendor documentation.
- For OpnSense, for example, you would need to navigate to HTTP(s) Location > Advanced Settings > Advanced Proxy Options and set the Proxy Read Timeout to 999999.
Summary
504 errors in webmail when using a proxy can be resolved by adjusting the proxy read timeout setting. This solution applies to standard nginx but can also be applied to other proxy servers.
FAQ
-
What does the 504 error mean?
A 504 error is a server-side error that indicates a gateway timeout. It occurs when a server doesn't receive a timely response from another server that it was accessing while attempting to load the web page or fill another request by the browser. -
What is the 'proxy_read_timeout' setting?
The 'proxy_read_timeout' setting in nginx is the amount of time the server will wait for a response from a proxy server. If the proxy server doesn't respond within the set time, a 504 error can occur. -
What if I'm still experiencing the 504 error after adjusting the 'proxy_read_timeout' setting?
If you're still experiencing the issue after adjusting the 'proxy_read_timeout' setting, it's recommended to check your server's error logs for any additional information that may help troubleshoot the issue.