Forum Discussion

brad9iner_11512's avatar
brad9iner_11512
Icon for Altostratus rankAltostratus
Mar 06, 2015

redirect from one domain to a sub-domain

So currently I have the need to get a redirect working for going from the root domain to a sub-domain. Current version of the F5 that I am working with is BIG-IP 11.2.1 Build 1306.0 Hotfix HF13.

https://sandboxcernercentral.com/audit-reports/admin is needing to be redirected to https://associates.sandboxcernercentral.com/sentinel

Here is the the iRule I have come up with but it is not working properly for me:

when HTTP_REQUEST {
if { [HTTP::host] eq "sandboxcernercentral.com" }{
if { [HTTP::uri] starts_with "/audit-reports/admin" }{ 
    HTTP::redirect "https://associates.sandboxcernercentral.com/sentinel"
    }
    } 
}

I try to do a curl to test out the redirect: curl -i https://sandboxcernercentral.com/audit-reports/admin

but it's getting a response of: curl: (56) SSLRead() return error -9806

I have a similar iRule setup for the root domain when just audit-reports is in the URI:

when HTTP_REQUEST {
if { [HTTP::host] eq "sandboxcernercentral.com" }{
if { [HTTP::uri] starts_with "/audit-reports" }{ 
    HTTP::redirect https://sandboxcernercentral.com/sentinel/
    }
    } 
}

It is working as expected and getting the following results from the curl:

curl -i https://sandboxcernercentral.com/audit-reports/
    HTTP/1.0 302 Found
    Location: https://sandboxcernercentral.com/sentinel/
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0

Not sure where to go from here as to why we are getting the SSLRead error.

4 Replies

  • Your iRule looks perfectly valid. Sounds like you are getting an SSL error from your site that is being redirected to.

     

  • Try a verbose output on the curl (-v) and see if you can debug why the SSL error is being reported. You can also try -k to ignore some SSL errors. For example, the type that a browser would normally let you click through and ignore. This helps isolate the HTTP functionality from the rule.

     

  • I actually got it to work. Had to swap up the validators for the HTTP:URI statements from starts_with to equals. Since I was using the 2 similar URIs the requests going to the /audit-reports/admin were getting caught by the one doing requests for /audit-reports. Thank you for the help.