Forum Discussion
Is there any string function that can calculate how many characters in a data variable in irule?
Hi,
give this a try:
string length [HTTP::uri]
- danielcJul 04, 2022Cirrus
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
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