Forum Discussion
Brett_11764
Nimbostratus
Nov 15, 2007Redirection Woes
Hi,
I have written an iRule to redirect users based on the requests that they make. The thing I had to watch here was that the redirection was to the same VIP.
What I need:
...
Don_Kindred_104
Nimbostratus
Nov 15, 2007
One thing to do in a case like this is to add logging statements so
you can see the actual HTTP requests. In many cases this will
allow you to figure out what is going wrong.
log local0. "requested [HTTP::host][HTTP::uri]"
From your URI (with "irj") I'm guessing this is SAP related. One
thing SAP can do if it isn't configured correctly is insert port numbers
for various URLs... which means your $host may also contain the
port number. For example "xyz:80" which your code would redirect
to "xyz:80.domain.com". That probably isn't what you want.
So you might change your $host initialization statement to strip
off any possible port suffix...
set host [getfield [string tolower [HTTP::host]] ":" 1 ]
Of course if you are intending to use something other than
port 80, you will need to make more modifications to appropriately
preserve the port number.
On the streamlining issue... one thing they emphasized in the
training course was that local variables are expensive/slow compared
to just [HTTP::host]. If you think about it, using a local variable
must actually involve allocating storage and looking the variable
name up. I do use some local variable despite this when it makes
my code much easier to read/maintain and I'm not concerned
with heavy load.
Hope this is of help.
--Don
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
