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.
...so just to be clear here's what is happening.
I have a virtual server listening on 443, doing SSL offloading.
The servers are listening on port 10108.
When the user is logged in (hitting the virtual on 443) there are links where they run reports and other stuff, when they click the link it's taking them to:
http://example.com:10108/longURIhere
If I ask the user to copy the "longURIhere" and go to:
https://example.com/longURIhere
it works.
So this to me looks like the redirect rewrite isn't working (though it is b/c it works for other things like when they login there is a redirect and if I disable redirect rewrite they get sent to 10108. So what am I missing?
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