Forum Discussion

satish_txt_2254's avatar
Nov 02, 2017

redirect https to other https with condition

I have following iRules, its bind with virtual server

VS_HTTPS
i wants if someone tyle
https://devs.example.com
then it should redirect to
https://dev.example.com
i have tried following but it didn't work.

in DNS dev and devs are both CNAME and they pointing to same F5 VIP

when HTTP_REQUEST {
  if { ([HTTP::host] eq "dev.example.com") or ([HTTP::host] eq "devs.example.com")  } {
     devs -> dev
    HTTP::redirect https://dev.example.com[HTTP::uri]
    pool dev_pool
  } elseif { [HTTP::host] eq "qa.example.com" } {
    pool qa_pool
  }
}

I am getting following error

$ curl -Ik https://devs.vivox.com
HTTP/1.0 302 Found
Location: https://dev.vivox.com/
Server: BigIP
Connection: Keep-Alive
Content-Length: 0

2 Replies

  • Hi,

     

    What is the error in curl command?

     

    Redirect always respond with 302 status code and location header equal to redirect uri.

     

  • Satish, Did you try sending the traffic through web interface, and saw redirection ?