I'm on Apache 2.2.15. My vhost.conf contains a RewriteRule to handle article URLs;
# handling for neat article titles
RewriteRule ^/news/[0-9]{4}/[A-za-z]{3}/([0-9a-zA-Z-]*)/([0-9]{4})([0-9]{6})/?$ "/news/article.cfm?clk=$2&article_id=$3&urltitle=$1" [P,L]
This is working correctly on our live server however on my local development server I'm getting a 502 Error in the browser when I try to load an article:
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /news/2015/news-article/0123012345.
Reason: DNS lookup failure for: localhost.example.com
Apache/2.2.15 (CentOS) Server at localhost.example.com Port 80
This is what I've got in the error log;
[Wed Oct 28 10:00:25 2015] [error] [client 192.168.1.66] proxy: DNS lookup failure for: localhost.example.com returned by /news/2015/news-article/0123012345, referer: http://localhost.example.com/
This leads me to believe that there must be something different in the config of the local server which is causing it problems.
These are the Apache modules I have enabled;
$ apachectl -M | grep proxy
proxy_module (shared)
proxy_balancer_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_ajp_module (shared)
proxy_connect_module (shared)
Syntax OK
$ apachectl -M | grep rewrite
rewrite_module (shared)
Syntax OK
Sorry if I've left out any pertinent information, grateful for any advice.
Best Answer
The message
indicates that the server is unable to resolve the hostname where the proxy module redirects the requests to.
Make sure you have the correct entry in your
/etc/hosts
file.