Hi,

I'm trying to configure a virtual host that, based on the host name,
forwards the request on a backend server listening on an unix socket.

My apache version is 2.4.18 as shipped by Ubuntu 16.04

The configuration I've tried so far is:

<VirtualHost *:80>
       ServerAdmin webmaster@localhost
       DocumentRoot /var/www/html
       LogLevel trace2

       UseCanonicalName Off

       RewriteEngine On
       RewriteCond %{HTTP_HOST} ^(.+)\.example.com
       RewriteRule "(.*)" "unix:/home/user/%1/server.sock|http://127.0.0.1$1 
[P,NE]

       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

The rewrite module works as expected (in the log file I can see the full
path to the unix socket), but trying to access the web server results in
a "400 Bad Request" *without* the involvment of the backend server.

I made a test with ProxyPass directive, and it works, but obviously is
not what I want:

<VirtualHost *:80>
       ServerAdmin webmaster@localhost
       DocumentRoot /var/www/html
       LogLevel trace2

       UseCanonicalName Off

       ProxyPass / unix:/home/user/subdomain1/server.sock|http://127.0.0.1/
       ProxyPassReverse / 
unix:/home/user/subdomain1/server.sock|http://127.0.0.1/

       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

How can I fix it?

Thank you
david

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to