cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP request to allow specific header

EduardoSousa
Altostratus
Altostratus

Hello guys.

I'm new to irules, I was looking for some irule that only allows a specific header to access the application, if you don't have this header allowed it will drop this connection attempt. Tried something along those lines, but VS doesn't have persistence.

when HTTP_REQUEST { if { [HTTP::header exists "Header_name"]} { persist uie [HTTP::header "Header_name"] } }

If anyone can help please? Thanks.

6 REPLIES 6

PeteWhite
F5 Employee
F5 Employee
when HTTP_REQUEST { 
    if { ! [HTTP::header exists "Header_name"] } { 
        drop
    }
}

EduardoSousa
Altostratus
Altostratus

Hi PeteWhite.

Thanks for the help, but this irule will drop the header I want to allow. Instead of drop, it would be allow, I tried to change the drop, but it didn't work.

 

Hi Eduardo,

The iRule i added above will drop any HTTP requests which don't have the specified HTTP header. Is that not what you wanted?

EduardoSousa
Altostratus
Altostratus

Hello Pete,

Yes that's what I want, I'll do one more test, thanks.

EduardoSousa
Altostratus
Altostratus

Hello Pete.

Is it possible to change the Irule to read the value and the header? For example, name = X-Custom-header and value = "ABCDEF123456"

when HTTP_REQUEST { 
    if { (! [HTTP::header exists "Header_name"]) || ([HTTP::header value "X-Custom-header" != "ABCDEF123456) } { 
        drop
    }
}