Forum Discussion
rhino_109458
Jan 18, 2012Nimbostratus
help on irule redirect
hello
f5 noob here
i have a machine running different virtual servers
i want to make a simple redirect to a speciffic URL and found this on some other posts
when HTTP_REQUEST
{
if { [HTTP::host] equals https://aaa.com} { HTTP::redirect https://aaa.com/hello }
}
though i get no errors when saving the irule typing in the browser https://aaa.com i get to my custom error page
on the log i can see that there was a block on /
seems to me the irule is not working
some help please?
thanks
- hooleylistCirrostratusSo you're using ASM and getting blocked because the / URI isn't defined in the policy? Out of curiosity, why don't you want to define / as an allowed URL in the ASM policy?
- hooleylistCirrostratusHi Rhino,
when HTTP_REQUEST { if { [string tolower [HTTP::host]] eq "aaa.com" and [HTTP::path] eq "/"} { HTTP::redirect https://aaa.com/hello } }
- rhino_109458Nimbostratushello hoolio
- hooleylistCirrostratusWhat do you mean by "by policy to the default page"? Can you try testing with curl from the LTM command line to the virtual server and reply with the output?
- rhino_109458Nimbostratuserm i wrote i am a noob should have written N000B :)
- rhino_109458Nimbostratusyes hoolio after adding the rule / still got blocked.
- hooleylistCirrostratusCan you try adding some debug logging and reply back with the logs? You can check for the output under /var/log/ltm or in the GUI under System | Logs | Local Traffic. If you put the logs in [ code ] [/ code ] tags (without the spaces) the event names in the logs will be preserved.
when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]" if { [string tolower [HTTP::host]] eq "aaa.com" and [HTTP::path] eq "/"} { log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to https://aaa.com/hello" HTTP::redirect https://aaa.com/hello } } when HTTP_CLASS_SELECTED { log local0. "[IP::client_addr]:[TCP::client_port]: Matched [HTTP::class]" }
- rhino_109458Nimbostratusgetting error when saving the rule
- hooleylistCirrostratusSorry, that should have been HTTP_CLASS_SELECTED instead of HTTP_CLASS_MATCHED. I updated the example above.
- rhino_109458Nimbostratusafter the fix :
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