Forum Discussion
Eric_Frankenfie
Nov 13, 2017Nimbostratus
HTTP Path Modification and Response Rewrite
I have a VIP which is hosting multiple versions of the same application: the current version (/APP_APP1153/APP1153.ashx)is sent to the pool configured on the VS, /G1/APP_APP1153/APP1153.ashx is sent ...
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
}
}
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects