Apache forward proxy incompatible with many virtual hosts

2

0

I have a Raspberry Pi running Arch Linux ARM that I use as an HTTP server, with Apache/2.4.29 (Unix). Recently, I have been trying to configure this machine as a forward proxy in order to use corkscrew or proxytunnel to connect to the Internet while using my laptop behind an evil firewall. So I added a virtual server with the following configuration:

<VirtualHost *:80>
    ServerAdmin webmaster@mydomain.com
    ServerName proxy.mydomain.com
    ErrorLog "/var/log/httpd/proxy-error_log"
    CustomLog "/var/log/httpd/proxy-access_log" common

    #SetEnv force-proxy-request-1.0 1
    #SetEnv proxy-nokeepalive 1

    ProxyRequests On
    ProxyVia Block
    AllowCONNECT 443 563 22 XYZ
    <Proxy *>
        Require ip XXX.XXX.XXX.XXX
    </Proxy>

    # The reverse proxy works, but the forward doesn't
    #ProxyPass /test https://google.it
</VirtualHost>

Besides that, I have two other virtual servers. The interesting thing is that the proxy works if it is the only virtual host enabled, but if I enable another vhost the proxy does not work anymore.

When the proxy does not work, I cannot use it with firefox (which says that the proxy is refusing connections), nor can I use it with corkscrew (which says that the proxy cannot connect to the server: method not allowed); also, in this situation the apache log file says "client denied by server configuration: /etc/httpd/htdocs". However, when I enable only the proxy virtual host, everything works, so it is not corkscrew's problem. Do someone know why? Thank you.

Federico Marotta

Posted 2018-03-10T21:29:39.107

Reputation: 21

Answers

1

You can't match the ServerName or ServerAlias for a forward proxy.

You can have a look at sslh or sshttp, they are ssh/http(s) multiplexers, to use both protocols on the same ports.

cheers

dader51

Posted 2018-03-10T21:29:39.107

Reputation: 133

1This is really awful. If anybody finds a way around it, please update... – Daniel – 2019-09-02T19:53:47.423