Technical Forum
Ask questions. Discover Answers.
Showing results for 
Search instead for 
Did you mean: 

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.



F5 Employee
F5 Employee

If I correctly gather what you're describing, clients communicate with the F5 VIP on port 80, so the URL is simply 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:

    HTTP::header remove "Accept-Encoding"
    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@@}

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