I want to redirect to http://domainname
if user types http://ip address
. What would be the frontend
rule?
For example, this rule can find out if www is prefixed to a domain and if not redirect to www.domain.com.
http-request redirect code 301 location \
http://www.%[hdr(host)]%[capture.req.uri] \
unless { hdr_beg(host) -i www }
Similarly, I want to redirect to www.domain.com when user types IP address in browser.
Since user types IP address in browser
, this may work:
http-request redirect code 301 location http://www.example.com%[capture.req.uri] if { hdr_reg(host) -i 127.0.0.1|192.168.1.100 }`
but it fails if user specifies Host: example.com