Forum Discussion
Patrick_Olsen
Nimbostratus
Nov 11, 2011Tomcat
I'm new to iRules and have been doing some research here. I have tried multiple redirect scenarios and they all seem to fail.
Current try looks like this:
when HTTP_REQUEST { if { [string tolower [HTTP::host]] eq "blah/manager/status" and [string tolower [HTTP::uri]] eq "/" } { HTTP::redirect } }
What am I missing?
Thanks!
8 Replies
- What am I missing?
if { [string tolower [HTTP::host]] eq "blah/manager/status"
this will never be true, as the host would be something like www.domain.com
Please try this:when HTTP_REQUEST { if { [string tolower [HTTP::host]] eq "www.domain.com" and [string tolower [HTTP::uri]] eq "blah/manager/statusblah/manager/status" } { HTTP::redirect http://www.blah.com[HTTP::uri] } }
Regards
Kurt Knochner - nitass
Employee
just in case if you have not seen this.
5-Minute iRules: What’s a URL?
http://devcentral.f5.com/weblogs/jason/archive/2010/09/29/5-minute-irules-whatrsquos-a-url.aspx - Patrick_Olsen
Nimbostratus
many thanks to both of you. I have not seen the 5-Minute iRules and Kurt thank you. - Patrick_Olsen
Nimbostratus
Unfortunately Kurt your suggestion didn't appear to work. I'm basically trying to make it so that whenever anyone requests the tomcat manager page it redirects them to the main host URL. Anyone have a good idea for this? - nitass
Employee
can you try this?[root@ve1023:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.65.152:http ip protocol tcp rules myrule profiles { http {} tcp {} } } [root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if {[string tolower [HTTP::host]] equals "blah" and [string tolower [HTTP::uri]] equals "/manager/status"} { HTTP::redirect "http://blah" } } } [root@ve1023:Active] config curl -I http://blah/manager/status HTTP/1.0 302 Found Location: http://blah Server: BigIP Connection: Keep-Alive Content-Length: 0 - Patrick_Olsen
Nimbostratus
Hi nitass,
I'm a bit confused as to why you would setup a SNAT and the portion after the rule myrule with the curl -I, I have never seen any of that used. Could you explain it a bit to me so that I can better understand it?
Thanks again for your time. - Michael_Yates
Nimbostratus
Hi Patrick,
I believe that nitass was just showing you the entire example of the Virtual Server that he used to apply the test iRule to, the test iRule itself, and then a successful test of the iRule using curl.
curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP,
SCP, SFTP, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.
The -I option Fetch the HTTP-header only! HTTP-servers feature the command HEAD which this uses to get nothing but the header of a document. When used on a FTP or FILE file, curl displays
the file size and last modification time only.
You can find out more about curl here: curl
Hope this helps. - nitass
Employee
Michael, thanks!
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
