Forum Discussion
Issue with http redirection in version 11.5.1(previously working with http class profiles in version 11.3)
Hi All,
we have some applications which need to be redirected to the servers meaning only works if uri is been added i.e. abc.com ---> abc.com/xyz/tmz/qpd.apex. So for that we used http class redirection profile in 11.3 version. Now in current scenario, we dont have http class profile in version 11.5.1. So i tried to use as following irule:
when HTTP_REQUEST { if { [string tolower [HTTP::host]] contains ".abc.com" } { HTTP::redirect "https://abc.com/xyz/tmz/qpd.apex [HTTP::uri]" pool Applivation_server } }
Issue: I am able to redirect to uri but in statistics see hit on VS, irule but no hit on Pool(Containing application servers) or Pool members(application servers).
Your reply on this been appreciated.
11 Replies
- StephanManthey
Nacreous
Hi Naumin Dave,
without knowing the exact configuration of your v11.3 http-class profile I just try to make a good guess regarding the iRule equivalent:when HTTP_REQUEST { test condition of matching hostname and client was not already redirected (default path) if { ([string tolower [HTTP::host]] ends_with "abc.com") && ([HTTP::uri] eq "/") } { redirect client into https and required path HTTP::redirect https://abc.com/xyz/tmz/qpd.apex return } else { forward client request for redirected traffic on non default path pool Application_server } }Thanks, Stephan
- Naumin_Dave_144
Nimbostratus
Hi Stephan,
So i tried to insert two statements in one if condition.
- For Redirection which redirects url.
- Send redirected url to pool.
But it works only for 1'st statement(Redirection works) but is not forwarding traffic to Pool.
- nathe
Cirrocumulus
Naumin Dave,
Do you just require a rewrite? If so I've tailored Stephen's irule:
when HTTP_REQUEST { test condition of matching hostname and client was not already redirected (default path) if { ([string tolower [HTTP::host]] ends_with "abc.com") && ([HTTP::uri] eq "/") } { rewrite URI to append /xyz/tmz/qpd.apex HTTP::uri "/xyz/tmz/qpd.apex" pool Application_server } }Hope this helps,
N
- StephanManthey
Nacreous
Do you see any errors in /var/log/ltm?
tail -f /var/log/ltmPlease be aware, that changes to your iRule will apply to new connections only.
A browser will try to maintain keep-alive connections and changes will not be working on existing connections. So closing all browser windows will be mandatory. Or just test via "cURL" (please replace value of host header and path accordingly):curl -I -H "Host: abc.com" http:///xyz/tmz/qpd.apex - Naumin_Dave_144
Nimbostratus
Hi Stephan,
If i will try to access using virtual ip, i am able to access page (after applying your irule) but page without any background images. And in tail -f /var/log/ltm, i am not able to see any error.
- StephanManthey
Nacreous
Nathan´s approach rewrites all incoming requests with a single URI. Images will probably requested by specific URIs and are missing that´s why. Can you please provide the configuration of your v11.3 http-class?
- Naumin_Dave_144
Nimbostratus
Hi Stephan, Sorry small correction. I am able to access page (after applying Nathan's irule). Also http class configuration is as follow:
- nathe
Cirrocumulus
what's the action in this http class? or can i assume it's set to none. in that case it would go to the VS default pool.
- Naumin_Dave_144
Nimbostratus
- StephanManthey
Nacreous
Hi,
as an equivalent my iRule would look like this:when HTTP_REQUEST { if { ! ([string tolower [HTTP::uri] starts_with /snortreport-1.3.4/) } { HTTP::redirect "https://172.27.95.203/snortreport-1.3.4/" } }As your 2nd screenshot does not contain the full redirection path it might be necessary to modify the path in the iRule above.
Thanks, Stephan - StephanManthey
Nacreous
You can add a log statement to validate incoming requests or use a browser plugin (maybe your browser cache just needs to be cleared?):
when HTTP_REQUEST { log local0. "request received <[HTTP::method]> <[HTTP::uri]> <[HTTP::version]>" if { ! ([string tolower [HTTP::uri] starts_with /snortreport-1.3.4/) } { HTTP::redirect "https://172.27.95.203/snortreport-1.3.4/" } }With the following command you can track new log messages:
tail -f /var/log/ltmPS: The iRule above requires to have a default pool assigned to the virtual server in the resource section.
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