Forum Discussion
Singh_74932
Nimbostratus
May 01, 2008302 to 301
I want to write an iRule which will :
If ( the response from webserver is 302 )
Then
convert it to 301 and insert the location of the redirected URL)
Using 9.x
Any help will be much appreciated.
Thanks
Raj
7 Replies
- hoolio
Cirrostratus
Hi Raj,
This example should do just that. If there is other info you need to include in the rewritten redirect, you can add it as an additional header or content. See the HTTP::respond wiki page (Click here) for details.when HTTP_RESPONSE { Check if the server response is a 302 if {[HTTP::status] == 302}{ Send a 301 response to the client with the Location header value from the server's response HTTP::respond 301 Location [HTTP::header value Location] } }
Aaron - Singh_74932
Nimbostratus
Got it .. but one thing is this 9.x dependent or we can do it in 4.x too ? - Nicolas_Menant
Employee
Hi,
The iRule engine was redesigned with v9X so an iRule written in 9x is not compatible with 4x - hoolio
Cirrostratus
Also, in 4.x there isn't an option to check the response status or modify the response sent to the client. You can only issue redirects or specify a pool based on request criteria.
Aaron - Singh_74932
Nimbostratus
u guys rock !! ..
Issue is that in our global infra some are 4.x and some are 9.x so any thing we can do that can run on both ? Or may be this one we can set for 9.x and some thing else for 4.x ? - Colin_Walker_12Historic F5 AccountThe issue is that with 4.x there is no way to check the traffic coming back from the client. You really need the full-proxy architecture of the 9.x systems to make something like this work.
Colin - hoolio
Cirrostratus
There is an issue with trying to send a response twice in the same response from an iRule using either HTTP::respond or HTTP::redirect. This issue wouldn't affect your ability to send a redirect after the pool member has responded with a redirect.
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
