http response
4 TopicsF5 iRule for X-Country-Code not working as expected
Is it possible to insert an X-Country-Code into the F5 BIG-IP response to the client. I want to do this only for a specific URI pattern. I tried the iRule below, using HTTP_REQUEST to capture the country code when the pattern /java is matched and substituting it in the HTTP_RESPONSE, but it didn't work. Any suggestions would be greatly appreciated. HTTP_REQUEST { if {[HTTP::uri] starts_with "/java"} { set country_code [whereis [IP::client_addr] country] log local0. "Matched /example - client IP: [IP::client_addr], country: $country_code" # Temporarily store country code in a header for use in HTTP_RESPONSE HTTP::header insert "X-Country-Temp" $country_code } } when HTTP_RESPONSE { if {[HTTP::uri] starts_with "/java"} { log local0. "HTTP_RESPONSE triggered for [IP::client_addr]" HTTP::header insert "X-Country-Code" "$country_code" log local0. "Added X-Country-Code: $country_code to response" } } Also I tried below in the response , but no luck when HTTP_RESPONSE { if {[HTTP::header exists "X-Country-Code" ]} { log local0. "HTTP_RESPONSE triggered for [IP::client_addr]" HTTP::header insert "X-Country-Code" "$country_code" log local0. "Added X-Country-Code: $country_code to response" } }78Views0likes3CommentsiRule to replace content of the location header on HTTP Responses
I'm trying to create an iRule that will detect if a web server is sending it's private IP address in the location header on it's responses. The logic is to read the location header in the responses, detect if the private IP addresses of the servers are included on them and replace the content of the location header to the website's URL, leaving everything else intact. This is the initial code I came up with. Should this work? Any better suggestions? when HTTP_RESPONSE { if { ( [HTTP::header Location] contains "10.0.0.11" ) || ( [HTTP::header Location] contains "10.0.0.12" ) } { [HTTP::header Location] replace "www.mywebsite.com" } }2.5KViews0likes3CommentsiRule When HTTP Response Behavior
I'm trying to do a thing where if the F5 detects that the pool does not have active members, it will redirect the users to a specific URL but in addition it will also delete a session cookie. I learnt from another question here on DevCentral that the HTTP::cookie remove needs to be used in the HTTP Response section for it to remove cookies from the user's browser. So the question is, would the HTTP::respond command triggered from the iRule also trigger the when HTTP_RESPONSE section of the same iRule? when HTTP_REQUEST { ... if { [active_members http_pool] = 0 } { HTTP::respond 302 noserver location "https://www.mywebsite.com" set pool_status "nomember" } } when HTTP_RESPONSE { if { $pool_status eq "nomember" } { HTTP::cookie remove "sessionID" } }308Views1like2Commentsirule for change the url and port
dear all i have customer who had proxy before, and the ideas is change the function of the proxy. unfortunately i think we must use irule to do that. here are the requirement : we need to replace the http with https, also if it contains port 8080 in the URL we must remove it. i dont know whether it used on the http response or request they need to edit http response content/body, if mime type are application/excel text/html text/plain, they need subtitute the http to https and remove port 8080 i hope all of you can help me solving this problem thank you692Views0likes1Comment