Forum Discussion
irule: http to https for a specific host
I have the following issue and need a way to redirect a specific host.
Issue: User types https://www.xyz.com/abc in the browser, request hits F5 which decrypts and forward it the server pool. When servers receive the request its in the form of http://www.xyz.com/abc and they respond with a redirect to http://www.xyz.com/def. Since only https is open on www.xyz.com the connection is terminated.
What i need is a i rule that converts that outbound http://www.xyz.com/def to https://www.xyz.com/def. Also it should not covert any other domains besides www.xyz.com. This is one of the reasons why redirect rewrite option did not work for us.
Please advise.
Thank You,
- Milan_4483NimbostratusI have the following rule but it does not interpret $host variable
- Michael_YatesNimbostratusYou can capture the protocol in the HTTP::header on the Response and change it.
when HTTP_RESPONSE { if { [ HTTP::is_redirect] and [URI::protocol [HTTP::header "Location" ]] eq "http" } { set path [findstr [HTTP::header "Location" ] "//" 2 ] HTTP::header replace "Location" "https://$path" } }
- hooleylistCirrostratusHi Milan,
- hvwees_37575NimbostratusPosted By Michael Yates on 03/17/2011 09:07 AM You can capture the protocol in the HTTP::header on the Response and change it. Try this and let me know if it works for you.
I really needed this and it works like a charm!when HTTP_RESPONSE { if { [ HTTP::is_redirect] and [URI::protocol [HTTP::header "Location" ]] eq "http" } { set path [findstr [HTTP::header "Location" ] "//" 2 ] HTTP::header replace "Location" "https://$path" } }
I like to fix such things on the F5, instead of educating application developpers. 😉
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