Forum Discussion
commsmonkey_172
Nimbostratus
Sep 30, 2011Store variable from STREAM::expression and use in HTTP_RESPONSE context
Hi F5ers, I've been looking for a way to store the stream matched hostname in a HREF from a HTML stream. As I rewrite the content from internal domain to external domain using...
commsmonkey_172
Nimbostratus
Oct 03, 2011Hi Hoolio,
I'm not quite sure how that works.
I've taken another tact given the new insights herein.
The new issue I'm having is my string replacement does not appear to be functioning, my redirect appears to remain unvaried
When STREAM_MATCHED {
Insert $myVar to the URI component of the HREF following
the junction /Junction/ for subsequent ingress processing
set myVar [string tolower [getfield [STREAM::match] "." 1]]
STREAM::replace "external.domain.name/Junction/$myVar/"
}when HTTP_REQUEST {
Disable the stream filter for all requests via VS
STREAM::disable
Check URI for part of myVar (nodename01 to nodename19)
if {[HTTP::uri] contains "nodename"}{
set myVarCookie [getfield [HTTP::uri] "/" 3]
Set & Insert Cookie for processing
HTTP::cookie insert name "EV" value $myVar path "/"
Redirect client for processing by the Internal VS
ideally the preceding / needs to be removed after myVar as well
HTTP::redirect [string map {$myVar ""} [HTTP::uri]]
}
}
when HTTP_RESPONSE {
Disable the stream filter by default
STREAM::disable
Enable the stream filter for text responses only
if {[HTTP::header value Content-Type] contains "text"}{
Find the value I want to change, but manage change in STREAM_MATCHED
STREAM::expression {@string@@}
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