Forum Discussion
Stanislas_Piro2
Nov 14, 2017Cumulonimbus
You can try this code (not tested) with a stream profile assigned to the virtual server
when HTTP_REQUEST {
set uri "/APP_APP1153/APP1153.ashx"
set g1 0
set g2 0
disable compression to support stream profile
HTTP::header remove "Accept-Encoding"
if {[HTTP::uri] equals "/G1$uri" } {
[HTTP::uri] $uri
set stream_expression "@$uri@/G2$uri@"
set baseURI /G1
}
if {[HTTP::uri] equals "/G2$uri" } {
[HTTP::uri] $uri
set stream_expression "@$uri@/G2$uri@"
set baseURI /G2
}
}
when HTTP_RESPONSE {
if { [HTTP::status] == 302 {
This is a 302 redirect with a absolute Location URI
if {[scan [HTTP::header Location] {%[^:]://%[^/]%s} location_proto location_host location_uri] == 3} {
The Location header is absolute URI
HTTP::header replace Location $location_proto://$location_host$baseURI$uri
} else {
The Location header is absolute URI
HTTP::header replace Location $baseURI[HTTP::header Location]
}
} elseif {[HTTP::header value Content-Type] starts_with "text"} {
Apply stream expression stored in RULE_INIT event
if {$stream_profile_enabled} {
STREAM::expression $stream_expression
Enable the stream filter for this response only
STREAM::enable
}
}
}