I've got this Apache2 site configuration, allowing me to "run Apache as a proxy" of the localhost:8080
service.
<VirtualHost *:80>
ServerName foo.mydomain.com
RedirectPermanent / https://foo.mydomain.com/
</VirtualHost>
<VirtualHost *:443>
ServerName foo.mydomain.com
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://upstream%{REQUEST_URI} [P,QSA,L]
<Proxy balancer://upstream>
# following directive generates the error
BalancerMember http://127.0.0.1:8080
</Proxy>
ProxyRequests Off
ProxyVia On
ProxyPreserveHost On
RequestHeader set X_FORWARDED_PROTO https
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
SSLEngine on
SSLCertificateFile /etc/apache2/certs/foo.mydomain.com/host.pem
SSLCertificateKeyFile /etc/apache2/certs/foo.mydomain.com/host.key
ErrorLog ${APACHE_LOG_DIR}/error_foo_mydomain.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access_foo_mydomain.log combined
</VirtualHost>
When I restart Apache2 with service apache2 restart
an error is returned.
I saw that the problem is related to the following directive:
BalancerMember http://127.0.0.1:8080
If I comment that line, the error is gone and the server is started. Nevertheless, the proxy is not working. Syntax should be correct, so I don't exactly know how to solve this.
Of course, both proxy
and proxy_balancer
modules are enabled.
I've found a solution allowing me to proxy the
localhost:8080
service.