Hi,
I have an NGINX rule that needs to be translated to the equivalent iRules:
rewrite /api/user.getInfo.(.*) /api/user/getInfo.$1 last;
And this is the iRules I came up with:
"/api/user.getInfo.*"
{
scan [HTTP::uri] {/api/user.getInfo.%[^.]+} cap1
HTTP::uri /api/user/getInfo.$cap1
}
It does the URI transformation correctly; however, I get HTTP/1.1 302 Found back from it. Is there a way to perform a URI rewrite without returning 301/302 (redirection) status code on F5?
Thank you!
giltjr
June 26, 2015, 9:37am
2
Is the F5 returning the 301/302 or is server behind the F5 returning the 301/302 and the F5 is just passing it along?
The following irule may answer your need:
when HTTP_REQUEST
{
HTTP::uri [string map {"/api/user.getInfo." "/api/user/getInfo."} [HTTP::uri]]
}
Your irule did not generate 302 respond but if your request is :
http://www.company.com/api/user/getInfo.test
and getInfo.test is a directory on the web site, the web site will respond with a 302 to :
http://www.company.com/api/user/getInfo.test/
Thank you for the verification!
Apparently, it was my server from the default_pool that was returning 302 like you guys said. Specifying the pool in the iRule block fixed the issue.
"/api/user.getInfo.*"
{
scan [HTTP::uri] {/api/user.getInfo.%[^.]+} cap1
HTTP::uri /api/user/getInfo.$cap1
pool my_api_pool
}