Redirect to https with www for particulate domain on HAproxy

I've setup Haproxy, varnish and apache2 on ubuntu server and there are multiple web site running with http and https.

following setup configured as below:

---443--> | | HAProxy ------>Varnish(8081) ----------> apache2(8080)
---80---> |

haproxy.cfg

frontend http-example
bind *:80
frontend https-example bind *:443 ssl crt /etc/letsencrypt/live/ mode http http-request set-header X-Forwarded-Proto https default_backend example
backend example stick-table type binary len 32 size 30k expire 30m acl clienthello req_ssl_hello_type 1 acl serverhello rep_ssl_hello_type 2 tcp-request inspect-delay 5s tcp-request content accept if clienthello tcp-response content accept if serverhello stick on payload_lv(43,1) if clienthello stick store-response payload_lv(43,1) if serverhello server varnish 127.0.0.1:8081 check

Plan:

HAproxy : Here I have to configure, if user execute exmaple.com and then redirect to -For https

if example1.in then redirect to and so on.

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like