Forum Discussion
Randy_Johnson_1
Nimbostratus
May 20, 2009(should be) simple request ?
Hello, Group-
I'm pretty new to iRules, so I'm a bit gunshy on this.
Can anyone give me some help on what seems a pretty simple rule ?
We have two locations, providing webservices to our customers. I want to be able to send a redirect when a customer requests https://service1.company.com/services/service.asmx so that the customer is redirected to https://service2.company.com/services/service.asmx
I'd also like to log some diagnostics on this, just in case.
Anybody got something quick and dirty ?
Thanks, all !
3 Replies
- dennypayne
Employee
First thing is if you aren't offloading SSL, you won't be able to do this.
As long as you are, then this should work:when HTTP_REQUEST { if { ([HTTP::host] eq "service1.company.com") && ([HTTP::uri] eq "/services/service.asmx") } { HTTP::redirect "https://service2.company.com/services/service.asmx" log local0. "Whatever you want to log here" } }
I would not use the log in production if possible, only for debugging.
Denny - Randy_Johnson_1
Nimbostratus
Thanks, Denny -
Actually, I got it working (sort of) - at least as far as what I asked for (chuckle)
I used this, with the CLIENT_ACCEPTED, and logging statements in for debugging.
However, reading deeper into the forums has indicated I may need need to do something much different.
Our app is written such that a customer will be posting data to the asmx pages that comprise the service, and the POST data doesn't appear to be being sent through.
Troubleshooting this is difficult, as I can't easily build a test for it... My tools that we use to test don't like it when I use 'Fiddler' or other web debuggers which proxy the https connection.
when CLIENT_ACCEPTED {
set info "client { [IP::client_addr]:[TCP::client_port] -> [IP::local_addr]:[TCP::local_port] }"
log local0. $info
}
when HTTP_REQUEST {
log local0. "REQUEST Host: [HTTP::host], URI: [HTTP::uri]"
if { [string tolower [HTTP::host]] eq "service1.company.com"} {
log local0. "Host: [HTTP::host] matched service1 check"
HTTP::redirect "https://service2.company.com[HTTP::uri]"
log local0. "REDIRECTING TO : https://service2.company.com[HTTP::uri]"
}
} - dennypayne
Employee
Hmm...yes I don't think POST's "survive" redirects well in a lot of cases.
Here's the only posts I found so far on here:
Click here
Click here
Based on those, I think the only thing you could do would be to use HTTP::collect and then in HTTP_REQUEST_DATA send the traffic directly to a node that handles service2.company.com (similar to the rule in the 2nd post there).
Denny
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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