Forum Discussion
Corinna_Lo_1746
Nimbostratus
Aug 18, 2005https rewrite
hi,
We are trying to put Sakai/OSP behind our BigIPs.
The site is running https.
URL: https://eportfoliodev.wsu.edu/portal
I configured the BigIP to do the SSL, and then fowarded the http request to the load balancing pool (servers running Tomcat).
Unfortunately, the replies coming back from our server is http (of course). But passing the BigIP, they are not changed back to https.
I tried "Redirect Rewrite" on the https profile (tried all options - Matching, All, Nodes, None). But it doesn't work. According to the manual, this rewriting takes place only in the HTTP Location header of the redirection response, and not in any content. I guess that explains it.
Is it something I can accomplish using iRule? Basically, to rewrite all http in the response to https. And can you give me some sample code? I tried this, and doesn't work.
when HTTP_RESPONSE {
if { [HTTP::header location] starts_with "http://" } {
HTTP::header replace location "https://eportfoliodev.wsu.edu"
}
}
Any help is very much appreciated.
Thanks and regards
- corinna
- bl0ndie_127134Historic F5 AccountCorinna, yes the http profile option modifies only the ‘Location’ header and not the content. We are adding some really cool enhancements on the next release (v9.2) that will make this type of replacement trivial, but until then you will have to write some iRules.
- Corinna_Lo_1746
Nimbostratus
Thanks for your quick response. Meantime, while searching, I also found this great post: - bl0ndie_127134Historic F5 AccountHmm, I am a little baffled why it’s not working. I wonder if it’s because you are not setting up your request to HTTP/1.1. Try modifying the rule this way …
when HTTP_REQUEST { HTTP::version 1.0 } when HTTP_RESPONSE { HTTP::collect 4294967295 } when HTTP_RESPONSE_DATA { set find " Welcome" set replace "===============Test Rewrite===============" set offset 0 set diff [expr [string length $replace] - [string length $find]] Get indices of all instances of find string in the payload set indices [regexp -all -inline -indices $find [HTTP::payload]] puts "Got Payload \n[HTTP::payload]" if { $indices ne "" } { puts "iRule: wsu - Search Found $indices" } else { puts "iRule: wsu - Search Not Found" } foreach idx $indices { set start [expr [lindex $idx 0] + $offset] set end [expr [lindex $idx 1] + $offset] set len [expr {$end - $start + 1}] replace the instance of find with the contents of replace HTTP::payload replace $start $len $replace puts "\nNew Payload \n[HTTP::payload]" modify offset if the replace string is larger or smaller than find. incr offset $diff } }
when HTTP_REQUEST { HTTP::version 1.0 } when HTTP_RESPONSE { HTTP::collect 4294967295 } when HTTP_RESPONSE_DATA { set find " Welcome" set replace "===============Test Rewrite===============" set payload [HTTP::payload] if {[regsub -all $find $payload $replace new_response] > 0} { HTTP::payload replace 0 [HTTP::payload len] $new_response } }
- bl0ndie_127134Historic F5 AccountCorrection, I meant to say 'setting up your request to HTTP/1.0.'
- Dale_Miller_104
Nimbostratus
You may wish to contact Daniel Spillers (djspillers@ualr.edu). We ended actually making a modification to Sakai to fix the problem for good. I think it has gone back to the develpoers for the next release. - Randy_127952Historic F5 AccountWe have seen successful https rewrites done using a stream profile, which works at the tcp level.
- Corinna_Lo_1746
Nimbostratus
yes, I've contacted Daniel. He is very helpful, and shared with us on how he changed in the sakai code to return a https page after logon. But other than that, we found that all other links generated by sakai are still on http. That means two problems:
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