Forum Discussion
Lon_bale_55412
Nimbostratus
Nov 06, 2009URI redirection https to an external http URL
Currently we are trying to redirect a to an external URL from one that sits behind the F5 with no luck.
The user hits the site via https://myserver/spaces and we are trying to redirect the user to an external source http://myserver1/spaces. If we turn off rewrite/redirect then it works, but can't do this so does anyone have any idea how to redirect a user from https:// to an external http:// url?
- The_Bhattman
Nimbostratus
So you are trying to redirect from the VIP to the specific server behind the load balancer? - Lon_bale_55412
Nimbostratus
we are redirecting from the VIP to an external URL at a different location. We have asp.net code that looks for a specific URL, and redirects the user to the correct url in a different city. The code redirects the user to http://newserver and the F5 is appending https://newserver when the redirection happens. - hoolio
Cirrostratus
You could replace the HTTP profile functionality for rewriting redirects with an iRule that inspects the Location header in redirects and only rewrites to https:// for your specific scenarios. If you have a lot of URIs to check you could add them to a datagroup. In this example, I've used a class named locations_to_preserve_classwhen HTTP_RESPONSE { Check if response is a redirect if {[HTTP::is_redirect]}{ Save the Location header value to lowercase set location [string tolower [HTTP::header Location]] Check if the Location header value starts with http:// and is not one to preserve as http:// if {$location starts_with "http://" \ and not ([matchclass $location starts_with $::locations_to_preserve_class])}{ Replace http:// with https:// in the Location header HTTP::header replace Location [string map "http:// https://" $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