Forum Discussion

Emad's avatar
Emad
Icon for Cirrostratus rankCirrostratus
Jul 07, 2015

Allow specif files to be upload

I need to allow specific files to be uploaded in a app. e.g not allowing .exe or .sh Issue is that file is uploaded in post via content of request. how can this be managed via LTM policy or of irule.

File Name is mentioned as followin in Content-Disposition header.

Content-Disposition: form-data; name="filedata"; filename="test.php"

1 Reply

  • Could you just create an iRule that will reject requests to upload certain files? Something like

    when HTTP_REQUEST {
        if { [HTTP::header exists "Content-Disposition"] } {
            switch -glob [HTTP::header value "Content-Disposition"] {
                "*filename=*.exe*" -
                "*filename=*.sh*" {
                     Reject however you'd like:
                     reject
                     HTTP::redirect "/error"
                }
            }
        }
    }