Muthuvel P
Muthuvel P

Reputation: 147

apache httpd 2.4.37 forward proxy not working

I have build apache httpd 2.4.37 from source in redhat and installed in home directory [/home/test/httpd-2.4.37]. as I don't have root access to install from yum. The server is running, I want to use this server only as a forward proxy.

I have the following modules in /home/test/httpd-2.4.37/conf/httpd.conf and the files in /home/test/httpd-2.4.37/modules

LoadModule proxy_module modules/mod_proxy.so LoadModule
proxy_connect_module modules/mod_proxy_connect.so LoadModule
proxy_ftp_module modules/mod_proxy_ftp.so LoadModule
proxy_http_module modules/mod_proxy_http.so LoadModule
proxy_fcgi_module modules/mod_proxy_fcgi.so LoadModule
proxy_scgi_module modules/mod_proxy_scgi.so LoadModule
proxy_uwsgi_module modules/mod_proxy_uwsgi.so LoadModule
proxy_fdpass_module modules/mod_proxy_fdpass.so LoadModule
proxy_wstunnel_module modules/mod_proxy_wstunnel.so LoadModule
proxy_ajp_module modules/mod_proxy_ajp.so LoadModule
proxy_balancer_module modules/mod_proxy_balancer.so

I have added below configuration at end of /home/test/httpd-2.4.37/conf/httpd.conf file.

Listen 127.0.0.1:8090 ProxyRequests On ProxyVia On ProxyPreserveHost Off

<Proxy "*">
    Order deny,allow
    Allow from all
</Proxy>
ErrorLog "/home/test/httpd-2.4.37/logs/proxy-error.log"
CustomLog "/home/test/httpd-2.4.37/logs/proxy-access.log" common

forward proxy is not working , when I call from a another machine using this proxy, I am getting connection refused as response.

no log is getting updated /home/test/httpd-2.4.37/logs/proxy-error.log & /home/test/httpd-2.4.37/logs/proxy-access.log

Upvotes: 0

Views: 1761

Answers (1)

Muthuvel P
Muthuvel P

Reputation: 147

My primary objective is to tunnel ssh request over thru proxy. I have added the below change at the end of httpd.conf file. Proxy is working and forwarding the request to the destination.

Listen 8090
<VirtualHost *:8090>

  RewriteEngine On
  RewriteCond %{REQUEST_METHOD} !^CONNECT [NC]
  RewriteRule ^/(.*)$ - [F,L]

  ProxyRequests On
  ProxyBadHeader Ignore
  ProxyVia On

  AllowCONNECT 22 64

    <Proxy "*">
        Order deny,allow
        Require ip 10
    </Proxy>
    ErrorLog "/home/test/httpd-2.4.37/logs/proxy-error.log"
    CustomLog "/home/test/httpd-2.4.37/logs/proxy-access.log" common

</VirtualHost>

Upvotes: 1

Related Questions