How to fix 'Proxy Error 502'?

I am running a apache web server and then doing reverse proxy to confluence server. when I try to upload some files to confluence server (less than 100MB) it woks fine (it takes around 3 minute to upload)

but I have one big file close to 300MB which takes more than 10 minute to upload and upload gets failed and I get below error:

Proxy Error 502 : The proxy server received an invalid response from an upstream server

Open in new window

Here is my proxy configuration.

#Rewrite rule for Confluence
RewriteCond     %{HTTP_HOST}    ^     [NC]
RewriteRule     ^/(.*)$$1        [P]
ProxyPassReverse /

I believe issue would be related to timeout setting somewhere. Appreciate if someone can help me in fixing it.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It's possible that Apache is timing out before the upload is completed. Check your httpd.conf file settings. See if the values are smaller or large than the following:
Timeout 2400
ProxyTimeout 2400
ProxyBadHeader Ignore

Also, have you tested bypassing the reverse proxy and going directly to the "confluence server" just to make sure that that you are ruling it out as the problem?

Do you know if the upload form is written in PHP? If so, check php.ini setting for:
beer9Author Commented:
confluence is written in java and running in Tomcat

I see following entry in my httpd.conf
# Timeout: The number of seconds before receives and sends time out.
Timeout 60

Open in new window

beer9Author Commented:
I bypassed the reverse proxy and uploaded the file directly using url of app server (confluence) then I got below result:

The following error(s) occurred:
Your request could not be processed because a required security token was not present in the request. You may need to re-submit the form or reload the page.

Open in new window

@beer9 - About how long does it take for the 300Meg upload to fail?
@beer9 - The web server logs might provide some insight to failure as well. Here's some places to look on the APACHE instance:
RHEL / Red Hat / CentOS / Fedora Linux Apache error file location - /var/log/httpd/error_log
Debian / Ubuntu Linux Apache error log file location - /var/log/apache2/error.log
FreeBSD Apache error log file location - /var/log/httpd-error.log
Windows - C:\Program Files\Apache Software Foundation\Apache2.2

I'm not sure where confluence stores its web error logs.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.