Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    HAProxy configuration for roundcube

    Scheduled Pinned Locked Moved HA/CARP/VIPs
    4 Posts 2 Posters 34 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      NickJH
      last edited by

      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

      V 1 Reply Last reply Reply Quote 0
      • V
        viragomann @NickJH
        last edited by

        @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.

        N 1 Reply Last reply Reply Quote 0
        • N
          NickJH @viragomann
          last edited by

          @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.

          V 1 Reply Last reply Reply Quote 0
          • V
            viragomann @NickJH
            last edited by

            @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".

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.