Forum Discussion
dp_119903
Jan 04, 2017Cirrostratus
Redirect Rewrite not working - how write an irule to redirect non-standard port
Simple port change, just not sure which path to take.
I have a virtual server that is listening on 443. It redirects to a server on the backside that is listening on http (not SSL) via port 10108....
- 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.
dp_119903
Jan 04, 2017Cirrostratus
...after thinking about this for a few more minutes I think it's probably pretty simple.
- create a virtual server listening on port 10108
- create an irule that simply redirects anything inbound to that to the https:// site without the port
- so if that's the case...I can do that, but isn't this what redirect re-write is really for?
- How can I troubleshoot redirect rewrite?
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