Forum Discussion
Kamiza_49017
Nimbostratus
Jan 19, 2010Redirecting to External IP Address
Hi,
Is it possible by an irule to redirect based on based on the destination IP address all connections to another IP address on the internet?
I am pretty new to the Irul...
hoolio
Cirrostratus
Jan 19, 2010Hi Brett,
Sure, you can issue a redirect to a hostname or IP address. Here are some examples:
when HTTP_REQUEST {
Redirect all requests to a new location using a 302 status redirect
HTTP::redirect "https://10.0.0.10/new_location.html"
}
when HTTP_REQUEST {
Redirect all requests to a new location using a 301 status
HTTP::respond 301 Location "https://10.0.0.10/new_location.html"
}
If you want to check the destination IP address, you can use IP::local_addr. But for a virtual server defined on a single IP address, this would always be the VIP address. To check the client IP address, you can use IP::client_addr. To evaluate one IP address or subnet against another IP address or subnet, you can use the IP::addr command.
Here are wiki links for the various commands:
http://devcentral.f5.com/wiki/default.aspx/iRules/http__redirect
http://devcentral.f5.com/wiki/default.aspx/iRules/http__respond
http://devcentral.f5.com/wiki/default.aspx/iRules/ip__addr
http://devcentral.f5.com/wiki/default.aspx/iRules/ip__local_addr
http://devcentral.f5.com/wiki/default.aspx/iRules/ip__client_addr
Aaron
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