Forum Discussion
HTTP redirects with data group list
I need to perform many HTTP 302 redirects on one virtual server and would like to have a single iRule that calls on a single string type data group list to get the URLs to redirect to. In this particular case, they are all HTTP (no HTTPS) but it would be nice to have the flexibility of redirecting to a HTTPS URL. The logic that I am thinking of is:
Data group list "HTTP_redirects_list": String: somehost.com Value:http://www.someotherhost.com/this/that/otherthing ...
iRule: When HTTP_REQUEST if the URL matches a string found in the "HTTP_redirects_list" data group list then redirect to the related value found in the "HTTP_redirects_list" data group list else do nothing.
Thanks for your assistance
1 Reply
- richard_77048
Nimbostratus
I think you are looking for something like this:
when HTTP_REQUEST { Use [HTTP::path] or [HTTP::uri] depending on your needs set REQUEST [HTTP::path] if { [class match $REQUEST equals HTTP_redirects_list] } { set REDIRECT [class match -value -- $REQUEST equals HTTP_redirects_list] HTTP::redirect $REDIRECT } }edit: sorry about the formatting
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