Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4740

How to redirect non-www or www-without-ssl to www-ssl prefix in haproxy

$
0
0

@deepika wrote:

I am using haproxy 1.8.8 and trying to redirect non-www or www-without-ssl to www-ssl page.

Only following is needed to be redirected and domain has thousands of other subdomains that does not needed to be redirected:

1. http://example.com -> https://www.example.com
2. https://example.com -> https://www.example.com
3. http://www.example.com -> https://www.example.com

I am trying with following configuration, but it is not working properly (partial config below):

frontend www
    http-request redirect prefix https://www.%[hdr(host)] code 301 if { hdr(host) -i example.com }
    http-request redirect prefix https://%[hdr(host)] code 301 if { hdr(host) -i www.example.com } !{ ssl_fc }

With above code, (1) and (2) works perfectly but for (3), it gets redirected to https://www.www.example.com

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4740

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>