Forum Discussion

kamlyada_209668's avatar
kamlyada_209668
Icon for Nimbostratus rankNimbostratus
Aug 31, 2016

Getting below error for the VIP

Hello , We have created a VIP : uat-api.directory.kamlesh.com Who should redirect to : http://uat1-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap http://uat2-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap Above Redirection works correct as per the Irule- Irule attached here is - when HTTP_REQUEST { if {[string tolower [HTTP::host]] ends_with ".directory.kamlesh.com"}{ pool pool_uat_jboss7 HTTP::uri "/rest2ldap" } }

 

I made the following test on server. If I do a curl on http://uat2-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap/users/admin_f2400731 I got an answer from my application. If I do a curl on http://uat1-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap/users/admin_f2400731 I got an answer from my application.

 

But if I do a curl on https://uat-api.directory.kamlesh.com/users/admin_f2400731 I got an error : {"code":404,"reason":"Not Found","message":"Resource '' not found"}

 

Could any please help or suggest on it.Unable to understand where is the issue ? Thanks in advance. Regards Kamlesh Y

 

4 Replies

  • Okay, let's break this down, starting with the iRule:

    when HTTP_REQUEST { 
        if { [string tolower [HTTP::host]] ends_with ".directory.kamlesh.com" } { 
            pool pool_uat_jboss7 
            HTTP::uri "/rest2ldap" 
        } 
    }
    

    What you're saying here, is if the HTTP host header ends with ".directory.kamlesh.com", send that request to the pool_uat_jboss7 pool, and change the URI to /rest2ldap.

    So the request to

    http://uat2-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap/users/admin_f2400731 
    

    will match the HTTP host header requirement, send to the pool, and change the URI from /rest2ldap/users/admin_f2400731 to simply /rest2ldap.

    The request to

    http://uat1-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap/users/admin_f2400731 
    

    will also match the HTTP host header requirement, send to the pool, and change the URI from /rest2ldap/users/f2400731 to simply /rest2ldap.

    It's important to realize here that you've not provided any logic to tell the difference between uat1 and uat2. Are these running on separate uat1 and uat2 VIPs, or just one VIP for both? Further, you're replacing the incoming URI with a static /rest2ldap. Is that what you really want it to do? In any case, it would seem that a request to /rest2ldap on one of the backend servers is producing a 404 error.

  • Here VIP port is 443 and node port is 8080.Customer is accessing VIP port 443

     

    i.e.curl on https://uat-api.directory.kamlesh.com/users/admin_f2400731 I got an error : {"code":404,"reason":"Not Found","message":"Resource '' not found"}. Here there is One VIP for both nodes.

     

    Thanks to suggest .Just to know do i need to change Irule or the issue is related to application ? Regards Kamlesh y

     

    • ekaleido's avatar
      ekaleido
      Icon for Cirrus rankCirrus

      You need to change your iRule. It is not doing what it seems you intend for it to do. As kevin mentioned above, all your iRule does it match part of HTTP::host and change the HTTP::uri to some static value.

       

  • I made the following test on server. If I do a curl on http://uat2-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap/users/admin_f2400731 I got an answer from my application.

    Your iRule will ALWAYS change that to be http://uat-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap

    That is why it works direct to the server but not when processed by the BigIP. Try this:

    when HTTP_REQUEST {
      set orig_uri [HTTP::uri]
      if { [string tolower [HTTP::host]] ends_with ".directory.kamlesh.com" } { 
        pool pool_uat_jboss7 
        HTTP::uri /rest2ldap$orig_uri
      } 
    }