HAProxy + Dovecot + Gluster
Solution 1:
I do not believe there would be a difference between the two IMAP servers being directly accessible or via HAProxy. In both cases they form a HA solution with both servers having access to the same file system.
Using HAProxy prevents you from picking the IMAP server yourself while otherwise you could choose which server to use but this does not change the way you have to setup Dovecot or gluster.