HAProxy configuration for roundcube
-
I currently run a ClearOS reverse proxy which uses apache. I am getting rid of it, but I cannot see how to do a redirect for roundcube.
Externally I am using webmail.mydomain.com and ClearOS redirects this to internal_server.mydomain.com/roundcube. In HAProxy, I can easily see redirect webmail.mydomain.com to internal_server.mydomain.com where it would be picked up by the default server. I do not see how to append the /roundcube to the path.
The relevant lines in the apache proxy config are:
ProxyPass / http://internal_server.mydomain.com/roundcube/ ttl=120 retry=0 connectiontimeout=5 keepalive=on ProxyPassReverse / http://internal_server.mydomain.com/roundcube/ ProxyPassReverseCookiePath /roundcube /
I am not worried about https as HAProxy looks after that.
Can anyone please guide me?TIA,
Nick
-
@NickJH
HAproxy basically simply forwards requests to an IP and port. It does neither change the host name in the header, nor change the path. If you need this, however, you have to create rules to instruct HAproxy to make the changes.To insert "/roundcube" into the path, create an action, select "http-request set-path" and enter "/roundcube/%[path]" in the "fmt" box below.
If your roundcube backend is expecting "internal_server.mydomain.com" for the host header, also create an "http-request header set" action. Specify "host" for the name and "internal_server.mydomain.com" for the value.
If the frontend handles multiple backends, you will have to bind these rule to an ACL, when configured in the frontend. But you can also add them to the backend.
-
@viragomann Thanks for the solution. I had just got there after playing around for a couple of days and it works, just setting it in the backend.
I am still playing round with the idea of using a vhost on the internal apache server so it understands directly "webmail.mydomain.com". The problem I have there is that it runs on Debian in /var/lib/roundcube and to get it to work I have to set:
<Directory /> Options FollowSymLinks AllowOverride None Require all granted </Directory>
rather than:
<Directory /var/www/roundcube> Options FollowSymLinks AllowOverride None Require all granted </Directory>
and it makes me jittery as I don't understand the implication. I am trying to find a solution for that.
-
@NickJH
Not clear, what you intend to achieve with this, but the Directory container in Apache is meant to be used for local paths. "/" might not be correct here.If you need to describe a virtual path use "Location".