Forum Discussion
ramann_75062
Nimbostratus
Apr 08, 2010Replace a header value with stream
hi@all,
i try to replace a part of a header value with STREAM
In the response, i get a 302 back. in this 302er I want to replace the protocol.
Example:
Location: http://www.myserver.com/dynamic-data0815
-->
Location: https://www.myserver.com/dynamic-data0815
My iRule:
--------------------
when HTTP_RESPONSE {
Need to explicitly disable the stream profile by default so it doesn't stay
enabled for subsequent HTTP requests on the same TCP connection.
STREAM::disable
Apply stream profile against text responses from the application
if { [HTTP::header value Content-Type] contains "text" }{
Look for http:// and replace it with https://
STREAM::expression {@http://@https://@}
Enable the stream profile
STREAM::enable
}
}
This section only logs matches, and should be removed before using the rule in production.
when STREAM_MATCHED {
log local0. "Matched: [STREAM::match]"
}
-------------------------
This works fine for all "http" in the body, but not for the header :-(
Version: BIG-IP 10.1.0 Build 3341.0 Final
Thanks for hints
bjoern
1 Reply
- hoolio
Cirrostratus
A stream profile is only applied against the payload. So if you have a TCP VIP, a stream profile would apply against the TCP payload. The TCP payload could be made up of HTTP headers and an HTTP payload. If you add an HTTP profile to the VIP, then the stream profile is only applied to the HTTP payload.when HTTP_RESPONSE { Rewrite the Location header for redirects from http:// to https:// if {[HTTP::is_redirect]}{ HTTP::header replace Location [string map -nocase "http:// https://" [HTTP::header Location]] } }
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