Forum Discussion
URL rewriting on our DR F5 for functionality testing
I did something similar to what Jason coded in the iRule.
Let's say I have a site called auctions.mydomain.com (not real obviously). The DR system (only for testing as the production system remains available during the test), has an IP in the DNS that resolves auctions-dr.mydomain.com. I point the "-dr" name to the DR site. In an iRule attached to the DR site virtual server, I do as Jason suggested and update the host header so my virtual hosting works. This works quite well except for a few sites that have not learned the virtues of relative links yet.
To handle that, I actually use a stream profile to catch any occurrence of the regular host name (auctions.mydomain.com in this case) and change it to auctions-dr.mydomain.com. I do that generally with some code to see if the host name is one of the real ones, then take the first node before the "-dr" so functionally, I remove the -dr. The stream and associated search and replace code handles cases where a link might have the original one. Note that I also found I had some limitations in using a stream when checking HTTP headers. For that, I also had to check in the Location header (as Jason suggested) to handle that too.
This works quite well and allows our test people to access the DR system from their desktops with no other changes than the extra iRule inserted into the DR virtual servers and the additional DNS entries.
I should say I also have a string class so I can check the hostnames. The reason is I have some domains that might be auctions.com but for the DR system, I need to send it to auctions-dr.mydomain.com. I have some code that looks for that case and adjusts the host header accordingly. If all your sites are at the same level in the domain, you might not need to worry about that.
I hope that helps. If you are interested in anything specific, let me know. I did not add any code as the examples already included show the idea.
Regards,
Tom Schaefer Better Software Solutions, Inc.
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