Forum Discussion

kiamars_51328's avatar
kiamars_51328
Icon for Nimbostratus rankNimbostratus
May 18, 2009

How can I get rid of the port on redirects.

Hi, I can redirect to new port, but how can i elemenated the port, I don't want to see the port that I am redirecting.

 

 

thx for your time.

 

 

1 Reply

  • Hi,

    Here is a Codeshare example which shows how to remove the port from the Location header value in 30x redirects:

    http://devcentral.f5.com/wiki/default.aspx/iRules/RewriteHTTPRedirectPort.html

     
     when HTTP_RESPONSE { 
      
         Check if server response is a redirect 
        if { [HTTP::header is_redirect]} { 
      
            Log original and updated values 
           log local0. "Original Location header value: [HTTP::header value Location],\ 
              updated: [string map ":[TCP::remote_port]/ /" [HTTP::header value Location]]" 
      
            Do the update 
           HTTP::header replace Location [string map ":[TCP::remote_port]/ /" [HTTP::header value Location]] 
        } 
     } 
      
     

    Aaron