Forum Discussion

kriskoneru_3780's avatar
kriskoneru_3780
Icon for Nimbostratus rankNimbostratus
Nov 29, 2018

F5 load balancer issues with TFS 2018. Adding port 8080 when coming from load balancer

we are having F5 load balancer which is running on port 80 and we have two tfs 2018 servers which are load balanced and are running on port 8080. we are having a weird issue. when using TFS if a user is navigating to the build section it adds port 8080 to the URL. which causes the application to break. in our original URL we do not have a port numbers. ....*/tfs/. usually all the traffic comes to load balancer which is running on port 80 and then redirects to tfs server which is running on port 8080.

 

we asked the network team and even contacted Microsoft for support. They told us to see if preserve host headers are enabled on F5 and the network team said it is not enabled. we are having this issue from last two months.

 

Most of the times TFS runs fine with load balancer. But sometimes in certain sections of the application if the user clicks it adds port 8080 to the URL.

 

Any input from you is greatly appreciated.

 

1 Reply

  • If I correctly gather what you're describing, clients communicate with the F5 VIP on port 80, so the URL is simply http://www.site.com/tfs. But in some scenarios, the backend web server responds with URLs to itself, in document objects references in the HTML response, or as HTTP redirects, that include a port number (ex. ), which the browser tries and fails to access.

    If that's correct, the simplest option would be to strip the port number from responses using a STREAM expression. Add an empty STREAM profile to the VIP and an iRule that looks something like this:

    when HTTP_REQUEST {
        STREAM::disable
        HTTP::header remove "Accept-Encoding"
    }
    when HTTP_RESPONSE {
        if { ( [HTTP::header exists Location] ) and ( [HTTP::header Location] contains ":8080" ) } {
            HTTP::header replace Location [string map {":8080" ""} [HTTP::header Location]]
        } elseif { [HTTP::header value Content-Type] starts_with "text" } {
            STREAM::expression (@:8080@@}
            STREAM::enable
        }
    }
    

    The above will strip the :8080 value from the Location header if a redirect, or anywhere in the HTML response otherwise.