Jim_Betts_47293
Mar 25, 2008Nimbostratus
URL rewrite frustration
Howdy All:
After spending at least 4 hours searching DevCentral and dozens of attempts at trying to code the rules I need some help.
I have a web server (actually a Tumbleweed Secure Messenger) in my internal network (Inside FQDN=securemail.corp.com) that is accessed HTTP via port 8080. All access to this server is via URI "/securemail". I want users on the outside to access this system using HTTPS with our existing site certificate.
I have a large, elaborate iRule that I use to direct people to various pools depending on host names and URI that is working pretty well, what I want to do is to add some URI rewriting so that I can translate the inbound hostname to the inside domain hostname. I'm truncating SSL before I forward the requests but need to ensure that he responses are in SSL. Here is what I have so far:
when HTTP_RESPONSE {
if { $Target_URI starts_with "/messenger" } {
set host "www.mycomp.com"
HTTP::header replace Host "www.mycomp.com"
set location [HTTP::header value Location]
regsub {securemail\.corp\.com} $location "www.mycomp.com" newLocation
HTTP::header replace Location "$newLocation"
}
}
when HTTP_REQUEST {
if { $Target_URI starts_with "/messenger" } {
set host "securemail.corp.com:8080"
HTTP::header replace Host "securemail.corp.com"
set location [HTTP::header value Location]
pool Tumbleweed-SM
}
}
In summary here is what needs to happen:
Inbound request-> https://www.mycomp.com/messenger/xyz
Request forwarded-> http://securemail.corp.com:8080/messenger/xyz
Outbound response-> https://www.mycomp.com/messenger/xyz (with URI generated by server)
Response I'm getting-> http://securemail.mycomp.com/messenger/xyz
Any suggestions would be appreciated.