0

I've spent most of today playing with haproxy as I'm interested in using it as a proxy to a bunch of websites.

Some are http, some are https and it seems to work well but I have a question where I'm swamped in the documentation and cannot find what I want.

Let's say I have www.proxieddomain.com and I have ACLs to allow paths like /folderA and /folderB and so on.

I want any traffic for /invalidpath to just get sent to either www.proxieddomain.com, or to get sent to www.corpwebsite.com which isn't behind haproxy.

What's the suggested way to do this please?

1
  • Do you want HAProxy to redirect the browser or forward the request itself? If the latter, that isn't a "redirect." Aug 21, 2016 at 22:58

2 Answers 2

1

In the frontend configuration:

# Define ACL
acl is_valid_path path_beg /folderA /folderB

# Redirects based on ACL condition    
redirect prefix http://www.proxieddomain.com code 301 append-slash if !is_valid_path
0

According to the official documentation:

redirect location [code ] [{if | unless} ]

redirect prefix [code ] [{if | unless} ]

redirect scheme [code ] [{if | unless} ]

  • Return an HTTP redirection if/unless a condition is matched

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .