Thursday, July 23, 2009

Apache mod_proxy and tomcat

If you use apache to forward request to a local running tomcat, you may encounter this error message in the error.log:

[error] (13)Permission denied: proxy: HTTP: attempt to connect to 127.0.0.1:8080 (*) failed


If you have SELinux running you have to check if it allows local connections, by running:



getsebool -a | grep httpd


you have to check that the following is written:



httpd_can_network_connect –> on


if it is off, you have to enable it:



setsebool -P httpd_can_network_connect=1


and restart your apache.



This tip has been taken from: http://swapyourbooks.com/welcome/knowledgebase/misc/selinux-allow-httpd-tomcat-proxy.html

1 comment:

carte sdhc 32gb said...

The servlet API calls of interest, for this purpose, are:

* ServletRequest.getServerName(): Returns the host name of the server to which the request was sent.
* ServletRequest.getServerPort(): Returns the host name of the server to which the request was sent.
* ServletRequest.getLocalName(): Returns the host name of the Internet Protocol (IP) interface on which the request was received.
* ServletRequest.getLocalPort(): Returns the Internet Protocol (IP) port number of the interface on which the request was received.