Forum Discussion
How to direct traffic to different folders based on incoming subdomain?
Hi,
I am stumped on writing an iRule to take in the URL coming on a shared VIP (DNS entry set for different sub domains to go to the same VIP) and direct to the proper folder in the IIS pool based on the incoming sub domain. Any help would be greatly appreciated. I am fairly new at this and I am thinking this is a fairly easy iRule to write.
Example:
https://one.mydomain.com/ maps to http://[HTTP:host]/appone
https://two.mydomain.com/ maps to http://[HTTP:host]/apptwo
where one.mydomain.com and two.mydomain.com have a DNS entry for each pointing to a shared VIP and web pool.
Normally, I would farm these out to different pools, but due to some development related issues, that isn't an option at this time.
Again, any help is greatly appreciated.
Thanks.
J
5 Replies
- t-roy
Nimbostratus
You sure you want to redirect HTTPS to HTTP? This should work:
when HTTP_REQUEST {
switch [HTTP::host] {
"one.mydomain.com" { HTTP::respond 301 "http://one.mydomain.com/appone" }
"two.mydomain.com" { HTTP::respond 301 "http://two.mydomain.com/apptwo" }
}
} - Joel_43353
Nimbostratus
@T-roy ... I am not necessarily looking at sending a redirect to the browser. These apps are technically coming in on the same VIP and using the same web pool. I am looking to forward it to the correct IIS path based on the incoming sub domain. - Joel_43353
Nimbostratus
I think using the word "direct" is a little misleading. I am looking to do a re-write based on the incoming subdomain. - t-roy
Nimbostratus
Gotcha, see 2: https://devcentral.f5.com/tech-tips/articles/redirects-rewrites-and-app-transfers-via-irules
That should get you what you need! - Joel_43353
Nimbostratus
That is very helpful. Thanks!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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