Forum Discussion
Redirect Rewrite not working - how write an irule to redirect non-standard port
- Jan 04, 2017
Well, enough digging and I guess you can answer your own question.
I found that a stream profile was needed, I presume b/c it wasn't actually a redirect but I'm not entirely certain. With that said, I applied an empty stream profile and the following irule:
when HTTP_REQUEST { tell server not to compress response HTTP::header remove Accept-Encoding disable STREAM for request flow STREAM::disable } when HTTP_RESPONSE { catch and replace redirect headers if { [HTTP::header exists Location] } { HTTP::header replace Location [string map {"http://" "https://"} [HTTP::header Location]] } only look at text data if {[HTTP::header "Host"] contains "10108" } { } { create a STREAM expression to replace any http:// with https:// STREAM::expression {@http://example.com:10108@https://example.com@} enable STREAM STREAM::enable } }
...and it works like a champ.
Well, enough digging and I guess you can answer your own question.
I found that a stream profile was needed, I presume b/c it wasn't actually a redirect but I'm not entirely certain. With that said, I applied an empty stream profile and the following irule:
when HTTP_REQUEST {
tell server not to compress response
HTTP::header remove Accept-Encoding
disable STREAM for request flow
STREAM::disable
}
when HTTP_RESPONSE {
catch and replace redirect headers
if { [HTTP::header exists Location] } {
HTTP::header replace Location [string map {"http://" "https://"} [HTTP::header
Location]]
}
only look at text data
if {[HTTP::header "Host"] contains "10108" } { } {
create a STREAM expression to replace any http:// with https://
STREAM::expression {@http://example.com:10108@https://example.com@}
enable STREAM
STREAM::enable
}
}
...and it works like a champ.
Recent Discussions
Related Content
* 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