Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Clear all filters
Answers

Getting error in IRULE for string map

Im Getting error for IRULE

error: [parse error: extra characters after close-brace][[HTTP::uri]] -------

Remove /content/abc from all requests

set RemoveContent 1
set RemoveContentSubOne 1
set RemoveContentSubTwo 0
set RemoveContentSubThree 1
if {$RemoveContent > 0} {
    if {([string tolower [HTTP::uri]] starts_with "/content/abc/apac/")
        or ([string tolower [HTTP::uri]] starts_with "/content/abc/emea/")
        or ([string tolower [HTTP::uri]] starts_with "/content/abc/latin-america/")
        or ([string tolower [HTTP::uri]] starts_with "/content/abc/")
       } {
        if {$RemoveContentSubOne > 0} {
            if {[string tolower [HTTP::host]] eq "sys-axecess.abc.com"} {
                if {([string tolower [HTTP::path]] contains "jcr_content") or ([string tolower [HTTP::path]] contains "jcr:content")}{
                    return
                } else {
                    set Redirected 1
                    set NoContentabc [string map -nocase {"/content/abc/apac/" "/" "/content/abc/emea/" "/" "/content/abc/latin-america/" "/" "/content/abc/" "/"}[HTTP::uri]]
                    HTTP::respond 301 location "https://sys-axecess.abc.com/$NoContentabc"
                    return
                }
            }
        } else {
            if {$RemoveContentSubTwo > 0} {
                set Redirected 1
                set NoContentabc [string map -nocase {"/content/abc/apac/" "/" "/content/abc/emea/" "/" "/content/abc/latin-america/" "/" "/content/abc/" "/"}[HTTP::uri]]
                HTTP::respond 301 location "https://[HTTP::host]/$NoContentabc"
                return
            }
        }
    }
}

#This section was added on 8-18 at Andrew's request to solve a problem with axe/hybris/prod in qual-beta urls.
if {$RemoveContentSubThree > 0} {
    if {[string tolower [HTTP::uri]] starts_with "/axe/hybris/"} {
        set HybrisProtectedURI [join [lrange [split [HTTP::uri] "/"] 4 end] /]
        HTTP::respond 301 location "https://[HTTP::host]/$HybrisProtectedURI"
        return
    }
}
0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Odd, I tried to test your iRule and I am not getting any errors after I put the code in the HTTP_REQUEST event. Maybe your finger slipped while saving?

0
Comments on this Answer
Comment made 1 month ago by Raja M 66

Actually my IRUL is Big im just updated whihc line im getting error

0