I found a hacky way to do it from mailing list archives

http://www.mail-archive.com/haproxy@formilux.org/msg03323.html

Regards,
Vivek

On Wed, Apr 20, 2011 at 10:09 PM, Vivek Malik <vivek.ma...@gmail.com> wrote:

> Hi,
>
> I am trying to issue a redirect via haproxy and want to reuse the host
> variable. Here is the configuration
>
> stunnel running on port 443 accepting connections for *.domain.com(unlimited 
> subdomain cert) forwarding to haproxy on port 81
> haproxy running on port 80 (for http for *.domain.com) and port 81 (for
> https via stunnel)
>
> frontend https
>    bind 127.0.0.1:81
>    acl allow_https if path /login /signup /forgotPassword
>    redirect prefix http://sub.domain.com if !allow_https
>
> Stunnel is using an unlimited subdomain SSL certificate which allows for
> https connection to *.domain.com. I want to redirect to
> http://sub.domain.com but I can't put the value of the sub without using a
> variable. I tried looking around but can't find out how to use the variable
> host inside the redirect prefix directive.
>
> Essentially, the config should be able to handle redirect for all
> subdomains
>
> https://foo.domain.com/something => http://foo.domain.com/something
> https://bar.domain.com/something => http://bar.domain.com/something
>
> Please help.
>
> Thanks,
> Vivek
>

Reply via email to