Hi, On 26.06.2013 15:44, Ciprian Roman wrote: > Hi, > > I want to avoid something like this: > > acl acl_foo_bar hdr_reg(host) -i ^www\.foo-bar.* > redirect prefix https://www.foo-bar.de <https://www.foo-bar.de/> if > acl_foo_bar !ssl-proxy > This is possible with haproxy 1.5dev13 and higher - http-request redirect scheme https if !{ ssl_fc } - > If I have 10 different domains I will have 10 sections like that. Is > it possible to make those two commands generic? > > Thanks for the empty_prefix solution, it works. >
you could use a dummy backend e.g. with lighttpd that just redirects everything and point your http requests to it. > Regards, > Ciprian > cheers thomas > > On Wed, Jun 26, 2013 at 2:51 PM, Thomas Heil > <[email protected] <mailto:[email protected]>> wrote: > > Hi, > > On 26.06.2013 11 <tel:26.06.2013%2011>:50, Ciprian Roman wrote: > > Hi guys, > > > > I am using the 1.4 version of HAProxy to balance a list of > > applications served from different domains. I want to use only > https, > > so I want to redirect all http requests to https. > > > > In the documentation I saw how to redirect to a specific prefix, > but I > > want to do that for all domains, so that when a new domain is > needed, > > I don't have to update the HAProxy documentation. > > > We do it like this: > -- > frontend fe_foo_bar > bind 141.1.1.2:80 <http://141.1.1.2:80> > #traffic to port 80 > bind 127.0.0.1:10447 <http://127.0.0.1:10447> id 11 > #traffic from stunnel, stud or pound > acl ssl-proxy so_id 11 > acl acl_foo_bar hdr_reg(host) -i ^www\.foo-bar.* > redirect prefix https://www.foo-bar.de if acl_foo_bar > !ssl-proxy > -- > > > > Also, I want to redirect urls like: https://mydomain.com to > > https://mydomain.com/login_page. I have tried to use path_beg, but I > > don't know how to specify the "empty path". > > > now you would declare something like this > > -- > acl empty_prefix path_reg ^/*$ > redirect code 302 prefix /login.page if empty_prefix > -- > > and ensure that this would happen only if https is selected like this > - > acl empty_prefix path_reg ^/*$ > redirect code 302 prefix /login.page if empty_prefix ssl-proxy > - > > > > Can you give me some pointers for these two tasks? > > > > Regards, > > Ciprian > > hope that helps, > > cheers > thomas > >

