F5-Bigip利用irule强行给请求植入Cookie的方法。
irule有两种做法可以让链接重定向
HTTP::redirect "http://redirect.domain.com[HTTP::uri]"
或者:
HTTP::respond 302 Location "http://redirect.domain.com[HTTP::uri]" "locale" $cookie
我们可以利用第二种方法来强行塞进cookie
when HTTP_REQUEST {
if {[HTTP::host] equals “find.domain.com” and [HTTP::path] equals “/” } {
set local_cookie [HTTP::cookie value lg_locale]
set cookie [format "locale=%s; path=/; domain=%s" $local_cookie "<cookiedomain>"]
HTTP::respond 302 Location “http://redirect.domain.com[HTTP::uri]” “Set-Cookie” $cookie
}
}
结果: