Forum Discussion

EddieV_26235's avatar
Icon for Nimbostratus rankNimbostratus
Nov 09, 2011

rewriting location header data

I'll just jump right into the good stuff. Here's my scenario:



wget --no-check-certificate -S "" -O /dev/null 2>&1 | grep " Location: " | grep --color "http://"











A customer has requested to see if the possibility exists to rewrite the location headers from http to https. The first "location: https" is the F5. We are terminating the ssl connection on the F5 and passing the connection to a pool of servers on port 80. We are using an HTTP profile to rewrite the response to https. Is it possible to rewrite the rest of the location headers in the response?




I found and tried the iRule below but didn't work:










15 Check if response type is text



16 if{[HTTP::headervalue Content-Type] contains"text"}{






18 Replace http:// with



19 STREAM::expression{@http://@https://@}






21 Enable the stream filter for this response only



22 STREAM::enable



23 }



24 }




Any help would be greatly appreciated.




Thanks in advance!



2 Replies

  • Hi Eddie,



    You can rewrite headers using HTTP::header replace. However, why is the app returning multiple Location headers? The browser can only use one, so I'm a bit confused by what would happen if the client gets more than one.



  • why is the app returning multiple Location headers?i understand there are multiple location headers since wget follows redirection response.



    to EddieV, what about the 2nd and 3rd locations? where are they?