Forum Discussion

prasad_385282's avatar
prasad_385282
Icon for Nimbostratus rankNimbostratus
Apr 30, 2019

vip redirecting to pool member fqdn

I have a vip configured on port 80 and attached pool with a pool member listening on port 8000. when i do http;//vip fqdn then it is redirecting to pool member http;//poolmember fqdn on 8000

 

But i want no redirects from vip to pool member. I want the application to be used by vip name

 

current vip config:

 

ltm virtual vs_testngf { description vs_testngf destination 10.105.120.x:http ip-protocol tcp mask 255.255.255.255 pool pool_testngf profiles { http { } tcp { } } source 0.0.0.0/0 source-address-translation { type automap } translate-address enabled translate-port enabled vs-index 583 } Backend pool has tcp monitor, RR LB and single member on port 8000

 

what are my options to make application be browsed by single vip url

 

1 Reply

  • Hi, I so firs of try this irule:

    replace:

    • poolmember_fqdn1 by real hostname (fqdn) of your pool member
    • poolmember_fqdn2 by real hostname (fqdn) of your pool member

    Irule:

    when HTTP_REQUEST {
       save hostname for use in response
      set vip_fqdn [HTTP::host]
    }
    
    when HTTP_RESPONSE {
         Rewrite the Location header for redirects 
        if { [HTTP::header exists Location] }{ 
            HTTP::header replace Location [string map {"http://poolmember_fqdn1:8010" "http://$vip_fqdn" "http://poolmember_fqdn2:8010" "http://$vip_fqdn"} [HTTP::header Location]] 
        }
    }
    

    Then if you backend app is developped with absolute link without Relativ you can use this irule:

    when HTTP_REQUEST {
         Disable the stream filter for requests
        STREAM::disable
    
         Remove this header to prevent server from compression response
        HTTP::header remove Accept-Encoding
    
         save hostname for use in response
        set vip_fqdn [HTTP::host]
    }
    when HTTP_RESPONSE {
         Rewrite the Location header for redirects 
        if { [HTTP::header exists Location] }{
            HTTP::header replace Location [string map {"http://poolmember_fqdn1:8010" "http://$vip_fqdn" "http://poolmember_fqdn2:8010" "http://$vip_fqdn"} [HTTP::header Location]] 
        }   
    
         Rewrite the response content using a stream profile if it is text 
        if { [HTTP::header Content-Type] contains "text" } {
    
             Set the stream expression with the find/replace strings 
            STREAM::expression "@poolmember_fqdn:8010@vip_fqdn@" 
    
             Enable the stream filter 
            STREAM::enable 
        }
    }