Hi Chris, On Fri, Oct 16, 2009 at 02:50:44PM +0100, ch...@sargy.co.uk wrote: > > Hi Guys, > > I have a wildcard SSL certificate which I wish to do a redirect from > http to https whilst maintaining the original subdomain requested, eg: > > http://sub.domain.com/page should be redirected to > https://sub.domain.com/page > > I can't do this with redirect_prefix (it seems to require I know the > destination in advance) > > Can anyone point me in the right direction for this?
This would mean extract part of the "Host:" request header to build the "Location:" response header. We planned to implement that at one moment but it's still not done because there was no use of it yet. Do you have a lot of domains in your wildcard certificate ? In a first time you could write as many "redirect" rules as you have domains, if that's not too many. For instance : acl name1 hdr(host) -i name1.domain.com acl name2 hdr(host) -i name2.domain.com acl name3 hdr(host) -i name3.domain.com redirect prefix https://name1.domain.com if name1 redirect prefix https://name2.domain.com if name2 redirect prefix https://name3.domain.com if name3 See ? > Using haproxy 1.3.19 on a Centos 5 machine. Be careful with 1.3.19, it has a bug causing a random crash if you forget to set some timeouts on some instances. So be careful to have a defaults section with at least client/server/connect timeouts set. Regards, Willy