Forum Discussion
JimT02
Aug 28, 2016Nimbostratus
how can i rewrite meta refresh url on response
i have the following code for a response:
' '
i am trying to rewrite (via irule, stream) the ip address (xxx.xxx.xxx.xxx) to a FQDN host name url.
my normal http_response irule does ...
Kai_Wilke
Aug 30, 2016MVP
Hi Jim,
it doesn't matter where the tag is placed, since STREAM doesn't understand HTML at all. It just sees the flying by bits and bytes an then applies a replacements if a given search pattern is found.
Just combinaed my provided iRule logic with your provided HTML using the iRule below...
when HTTP_REQUEST {
Disable STREAM for HTTP_REQUESTs
STREAM::disable
Remove the "Accept-Encoding" header to see cleartext data on the responses.
Note: You could also use a HTTP-Compression Profile to remove the
Accept-Encoding header on the server side
(Profile Option: Keep Accept Encoding = Disabled).
By doing this, you can STREAM the content without losing
the ability to support a client side compression.
HTTP::header remove "Accept-Encoding"
if { [HTTP::path] eq "/stream" } then {
set content {
hi from jim
}
HTTP::respond 200 content $content "Content-Type" "text/html"
} else {
HTTP::path "/stream"
virtual [virtual]
}
}
when HTTP_RESPONSE {
Rechunk any Chunked Responses to become able to STREAM those content, without braking the Application.
if {[HTTP::header exists "Transfer-Encoding"]} {
HTTP::payload rechunk
}
Apply STREAM expression just to Content-Type = text
if {[HTTP::header value "Content-Type"] contains "text"}{
Set the STREAM expression
STREAM::expression {@https://1.1.1.1@https://www.site.de@}
Enable STREAM of the current response
STREAM::enable
}
}
Output:
hi from jim
Cheers, Kai
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