Forum Discussion

Hoang_Hung's avatar
Aug 07, 2020

Redirect IP to domain name

Dear all


My question is how can I redirect a user to a domain if he uses an IP instead of the domain.

Example: http: Redirect to

At this time: we have use 2 irule:

  • 1 irule redirect http to https ==> Work done( we try access to web via domain use http )

But. when we use ip instead of the domain. we can not rediect to domain

  • 2: irule:


if { ([HTTP::host] contains "")

      HTTP::redirect ""


but it is not work.

Please help us.

Thanks all


3 Replies

  • Hi Hoang Hung,

    Can you try this rules?

    iRule for http VS:

    when HTTP_REQUEST {
    	HTTP::redirect "[HTTP::uri]"

    iRule for https VS:

    when HTTP_REQUEST {
    	if { [HTTP::host] equals "" } {
    		HTTP::redirect "[HTTP::uri]"
      • zeeguy's avatar
        Icon for Nimbostratus rankNimbostratus

        I am looking to do a similar solution and wanted to check if the solution given by  Enes worked or not.