Apache Causing DNS Lookup Failures: What’s the Reason?

Click on “Manage IP” located at the bottom right corner and access the IP address table which will display the third column named “Reverse” or “PTR”, depending on your hosting provider. In my case, as I am using OVH VPS, I am able to modify the Reverse DNS.

Question:

The web server running on CentOS 7 utilizes tomcat to serve war files, which are accessed through an apache httpd reverse proxy. While this works seamlessly for war files that contain solely server-side code, the inclusion of client-side code such as AngularJS results in a proxy error being thrown by apache httpd for each dependency of the core html file when attempting to access the app through a web browser.

[proxy:error] AH00898: DNS lookup failure for: resources returned by /res$

To differentiate between an apache error and a tomcat error, I allowed access to the 8084 port for the app in firewalld. Then, upon loading

domain3.com:8084

, I observed that the app was functioning seamlessly, including its client-side AngularJS code.

Which modifications need to be made to the configuration to allow Apache httpd 2.4 to provide the client-side application’s includes bundled in the war file when users enter

domain3.com

in their web browsers?

The httpd logs pertaining to a single instance of

domain3.com

transaction are provided in their entirety.

[Tue Nov 03 14:31:57.662516 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013resources returned by /res$
[Tue Nov 03 14:31:57.747345 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013resources returned by /res$
[Tue Nov 03 14:31:57.752815 2015] [proxy:error] [pid 9294] [client client.ip.addr:57370] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:57.757663 2015] [proxy:error] [pid 11936] [client client.ip.addr:57372] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/an$
[Tue Nov 03 14:31:57.758121 2015] [proxy:error] [pid 4325] [client client.ip.addr:57371] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:57.758509 2015] [proxy:error] [pid 23006] [client client.ip.addr:57373] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/an$
[Tue Nov 03 14:31:57.762749 2015] [proxy:error] [pid 9325] [client client.ip.addr:57374] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:57.829953 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:57.846174 2015] [proxy:error] [pid 9294] [client client.ip.addr:57370] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:57.851022 2015] [proxy:error] [pid 4325] [client client.ip.addr:57371] AH00898: DNS lookup failure for: server.ip.addr:8013somecontroller.js returned$
[Tue Nov 03 14:31:58.049885 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:58.207199 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:58.320704 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:58.428737 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:58.523564 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:58.611546 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013js returned by /js/lib/ang$
[Tue Nov 03 14:31:58.708439 2015] [proxy:error] [pid 9332] [client client.ip.addr:57369] AH00898: DNS lookup failure for: server.ip.addr:8013somecontroller.js returned$

The tomcat logs for the identical

domain3.com

operation only display a single successful GET request.

client.ip.addr - - [03/Nov/2015:14:31:57 -0500] "GET / HTTP/1.1" 200 2944

The 502 errors are only observed by the client for the dependencies, not for

index.html

, which is the sole resource served without any errors.

The section that pertains to the subject in question can be found within

/etc/httpd/conf.d/virtualhosts.conf

.


    ServerName www.domain3.com
    ServerAlias domain3.com
    ErrorLog /var/log/httpd/domain3_com_error.log
    CustomLog /var/log/httpd/domain3_com_requests.log combined
    ProxyPass / ajp://server.ip.addr:8013
    ProxyPassReverse / ajp://server.ip.addr:8013

What modifications are required to make

httpd

handle the requests for the client-side app’s include files at

domain3.com

?



Solution:

Ensure that you append the absent trailing slash to both your

ProxyPass

and

ProxyPassReverse

directives.

ProxyPass / ajp://server.ip.addr:8013/
ProxyPassReverse / ajp://server.ip.addr:8013/

Frequently Asked Questions