aFlex script to filter URL

Hi experts do you have aFlex script to filter the URL that the users are trying to reach to the internet.
Basically, I have AC type class-list and URLs are configured on it. Once I have verified in aFlex that the URL which the user is trying to reach is on my class-list then I will redirect the traffic to a specific ISP.

Thank you

Hi, Sorry you have been waiting a while for a answer on this.
check this aflex out to get you going, basically its looking out for some url/uri you specify in a class-list file, if exists it will re-direct otherwise it will work as normal.

go here for lots of other well known examples, which you can copy and adapt and change, its a good place to start working on a similar aflex and change to your requirements.

extract below from this link.

a10networks/aflex-collection
Contribute to a10networks/aflex-collection development by creating an account on GitHub.
The class-list for the redirects is called

“cl-uris” (default) of type “string” and has

to contain the following data:

str

For example:

str /uri1

str /uri2

Scalability of this aFleX is unknown.

when RULE_INIT {
  set ::DEBUG 0
  set ::CLASSLIST “cl-uris”
}

when HTTP_REQUEST {
  set URI [string tolower [HTTP::uri]]
  if { [CLASS::match $URI starts_with $::CLASSLIST] == 1 } {
        HTTP::redirect http://[HTTP::host]
    if { $::DEBUG == 1 } { log “Redirected: $URI” }
  }
}
© 2021 GitHub, Inc.

please clarify and inform me if this is what you are after, it looks like you are already doing similar to my idea, will be good to know your thoughts as i think there are some better ways for client URL filtering.

Thank you Ebellamy. Basically, my goal is to managed HTTP and HTTPS traffic and apply some rules based on the URL.