Forum Discussion
irule forwarding to gtm address based on port
Is this possible...
Add the following irule to the gtm wide ip address..
when HTTP_REQUEST {
if { [TCP::local_port] equals "9074" } {
HTTP::redirect “test.com; } }
Then on the test gtm address pool have the members service port as *.
5 Replies
- Kevin_Stewart
Employee
GTM does not process HTTP traffic, so this event will never fire.
- Kevin_Stewart
Employee
Okay, so if a user makes an HTTP request to an LTM VIP with a destination port of 9074, you want to redirect the user to test.com. Assuming the client browser doesn't already have cached resolution for test.com, the browser will perform a DNS query to GTM for test.com. Is that correct?
- Kevin_Stewart
Employee
A wide IP is a point of DNS resolution and has nothing to do with ports. If you simply want to redirect to another URL, then you can do that in the LTM iRule and simply have GTM resolve the IP address of that URL.
- Kevin_Stewart
Employee
So i can't write an irule that checks the port coming in and if its 9074 then its sends it to a different url which happens to be a gtm address. Currently the vip etc only services port 80 traffic
Sure you can. The iRule you had in the first post would do that.
when HTTP_REQUEST { if { [TCP::local_port] equals "9074" } { HTTP::redirect "http://test.com" } }If the request is for the 9074 local port, redirect the client to http://test.com. GTM would resolve http://test.com to a different IP address.
- Kevin_Stewart
Employee
Well, yes, if the VIP is only configured for port 80, it will ignore any other port traffic. If you need to capture port 9074 requests, then perhaps you need to configure the VIP with a wildcard port and use an iRule to restrict it:
when CLIENT ACCEPTED { switch [TCP::local_port] { "80" - "9074" { return } default { drop } } } when HTTP_REQUEST { if { [TCP::local_port] equals "9074" } { HTTP::redirect "http:://test.com" } }
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