I am unable to correctly configure a reverse proxy for a web server. I have looked here and in other places for solutions to similar problems, but none seem to have helped in my case. Here is the setup:
I have an apache proxy server handling requests for virtual web servers in my environment (all on ubuntu 16.04.1). DNS is being handled externally (Cloudflare) and point to my one public IP address. My goal is to have the proxy server pass the requests to the correct virtual web server.
I have an internal DNS server and have confirmed that the virtual web servers are operating normally (all are accessible to internal requests), but when attempting to access externally, I'm unable to resolve any of them.
The following is my configuration for the proxy server virtual host:
ServerName foo.com ProxyRequests off ProxyPass / http://foo.com/ ProxyPassReverse / http://foo.com/
This seems to result in a timeout. This is the error I'm receiving in the apache logs on the proxy server:
[proxy_http:error] [pid 28581] (70007)The timeout specified has expired: [client 127.0.0.1:41410] AH01102: error reading status line from remote server foo.com:80, referer: http://foo.com [proxy:error] [pid 28581] [client 127.0.0.1:41410] AH00898: Error reading from remote server returned by /, referer: http://foo.com
As suggested in other similar questions, I've added the following lines to my apache config on the proxy server:
SetEnv force-proxy-request-1.0 1 SetEnv proxy-nokeepalive 1 SetEnv proxy-initial-not-pooled 1
However, now external requests are throwing a 502 after about 60 seconds, specifically stating:
The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /. Reason: Error reading from remote server
I have also tried this for my virtual host on the proxy server:
ServerName foo.com ProxyRequests off ProxyPass / http://10.0.0.1/ ProxyPassReverse / http://10.0.0.1/
Which results in a redirect loop.
I'd be happy to provide more details about my configuration.