Re: Location rewriting

From: Willy Tarreau <w#1wt.eu>
Date: Tue, 6 Apr 2010 20:46:46 +0200


Hi Craig,

On Tue, Apr 06, 2010 at 08:18:15PM +0200, Craig Craig wrote:
> Hi,
>
> I'm currently using two frontends on different ports for SSL/non-SSL Traffic. I run stunnel for SSL-termination, it forwards to one of the frontends.
>
> Unfortunately, it seems that haproxy on the non-ssl backend can't redirect a request to /$foo to https://mydomain.com/$foo ($foo is meant to be a variable...). You can already guess why I want this: it be a nice option to be able to fix websites/webapps with lots of hardcoded URLs to http://mydomain.com so that they always get redirected to the secure version. Not a very nice solution - I know.
> I guess, it would be the best thing to be able to use external scripts for rewriting, what do you think?
> Or is it possible to do this cleanly with some option I haven't seen? I thought about somehow rewriting headers, inserting a Location header etc. - but could that work?

you can do that with "prefix" :

  redirect prefix https://mydomain.com

It will concatenate that prefix with the URI from the request and put that in the location header. We also use it for http<->https redirects :-)

Regards,
Willy Received on 2010/04/06 20:46

This archive was generated by hypermail 2.2.0 : 2010/04/06 21:00 CEST