Forum Discussion
Ravi_Rajan_7549
Nimbostratus
May 03, 2006Redirect based on virtual directory name in IIS
Hi,
I am new to irules and need this help.
VIP: 192.168.100.100
Webpool1 - 4 Nodes, each containing ideal set of web applications.
Now apps are like http://192.168.100.100/app1, http://192.168.100.100/app2
I have requirement that the customer does not want to type http://servername/app1 instead he wants to type http://app1 to access app1.
We have around 50+ apps and all apps need to be accessed as http://appname.
TIA
Regards,
Ravi
7 Replies
- Ravi_Rajan_7549
Nimbostratus
Hi,
I have already got the DNS entries done in the local name servers. So now app1 resolves to 192.168.100.100. Now its the irule part which i need help.
TIA,
Regards,
Ravi - Ravi_Rajan_7549
Nimbostratus
Thanks, i will test this and let you know.
BTW, in the irule, where are we checking for http://app1 and then redirecting to http://192.168.100.100/app1
TIA,
Regards,
Ravi - Ravi_Rajan_7549
Nimbostratus
Hi,
This doesn't work and i get a bad request message. Can we log some messages in var/log/ltm to get some details.
TIA,
Regards,
Ravi - Colin_Walker_12Historic F5 AccountYou certainly can. You can insert log commands wherever you'd like in the rule to log information. Log commands look like:
log local0. "Info to log here. E.G. current host is [HTTP::host]"
Colin - Ravi_Rajan_7549
Nimbostratus
Hi,
Thanks !! I tried the below code and it worked !!
when HTTP_REQUEST {
if {[HTTP::host] ne "192.168.100.100"} {
HTTP::uri /[HTTP::host]
HTTP::header replace HOST "192.168.100.100"}
}
Now, I have some room for enhancement here. If the hostname is different from the actual virtual directory... For eg. user will type http://application and the redirection should happen to http://192.168.100.100/app1
I think we need to use arrays which map the URL name with the actual application name. Need views on this.
TIA,
Regards,
Ravi - Al_Carandang_11
Nimbostratus
You could create a DataGroup called AppDir and then useHTTP::uri /[findclass [HTTP::host] $::AppDir " "] HTTP::header replace HOST "192.168.100.100"
AppDir would be of type 'string' and contain entries likeapplication1 app1 application2 app2 application3 app3 ...
This would replace http://application1/ with http://192.168.100.10/app1 - Ravi_Rajan_7549
Nimbostratus
Thanks a bunch !! This works perfect. I am testing it and will come back if i have any queries.
Regards,
Ravi
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
