How to fix “Permission denied: proxy: HTTP: attempt to connect to (localhost) failed”



Permission denied: proxy: HTTP: attempt to connect to (localhost) failed – this error is because of httpd/apache2 has been denied permission to connect to IP address and port.

The reason for this error is SELinux.
Here SELinux not permitting httpd/apache2 to make network connections.

To resolve it, you need to change an SELinux boolean value (which will automatically persist across reboots).
You may also want to restart httpd/apache2 to reset the proxy worker, although this isn’t strictly required.

Run either of following command to allow SELinux to permit httpd/apache2 to make network connections:

$ /usr/sbin/setsebool httpd_can_network_connect 1


# /usr/sbin/setsebool httpd_can_network_connect true

Then restart httpd/apache2.