29-Jun-2022 22:07 - edited 29-Jun-2022 22:07
Hello,
For example I would like to know how many characters in [HTTP:uri] , is it possible to do so?
Thanks
03-Jul-2022 21:53 - edited 03-Jul-2022 22:18
Hello,
I have given it a try but faced problem:
when HTTP_REQUEST {
set thisuri [HTTP::uri]
...
}
when HTTP_RESPONSE {
if { [HTTP::status] == 404 } {
if { [ string length $thisuri ] > 2 } {
HTTP::respond 404 content "
<html>
<head>
<title>Not Found</title>
</head>
<body>
<h2>Not Found</h2>
This page is not found.<br>
<p></p>
</body>
</html>
} else {
HTTP::respond 404 content "
<html>
<head>
<title>Not Found</title>
</head>
<body>
<h2>Not Found</h2>
This website is not found.<br>
<p></p>
</body>
</html>
"
}
}
But I faced this error
01070151:3: Rule [/Common/check_url] error: /Common/check_url:63: error: [parse error: missing "]["
line 63 is HTTP::respond 404 content "
line 61 is if { [string length $thisuri] > 2 } then {
Any idea? Thanks
03-Jul-2022 23:09
You are missing a quotation mark (") after </html> in the if clause.
May i suggest, that you use a "real" editor to write iRules.
Maybe try VScode with the extension "F5 Network iRules". With propper syntax highlighting errors like this are more easy to spot.
07-Jul-2022 03:07
Thanks for your suggestion, I am using it, It is too difficult to do the irule programming directly on bigip.