# general project using haproxy



## wolffnx (Apr 21, 2021)

hi guys,I want to make a project involving haproxy
is a layer7 server in conjuntion with PF
(I dont have experience with haproxy)

my question is, if in haproxy
I declare a internal listen interface and external wan interface
and with the filters(http mode o tcp) , I can redirect to a web page
depending of the content of haproxy receive?


----------



## rudelgurke (Apr 25, 2021)

Partly you can, but it depends on what is meant with "content". You can redirect using SNI as example, so depending on what hostname is called, this or that backend is used.
Something like:

```
backend bk_ssl_default                                                                                
 mode tcp                                                                                             
 acl www-app req_ssl_sni -i www.example.org
 acl web-app req_ssl_sni -i web.example.org
 http-request set-header X-Forwarded-Proto https if { ssl_fc }
 use-server server-web if web-app
 use-server server-www if www-app
 use-server server-web if !www-app !web-app
 option ssl-hello-chk
 server server-www 10.0.1.1:443 send-proxy-v2
 server server-app 10.0.1.2:443 send-proxy-v2
```

Though when wanting to use redirects based on URL's haproxy might be the wrong choice and better use a HTTP proxy service.


----------

