Forum Discussion

alex100's avatar
alex100
Icon for Cirrostratus rankCirrostratus
Jan 13, 2020

iRule to Restrict access based on JSON Parameter Value

Hi all,

I need to restrict access to the application based on the values of two JSON parameters in payload of POST request.

My JSON looks similar to spinet below:

{
	"parameter1":null,
	"parameter2":"stringX",
	"contentType":"application/json",
	"parameter3":"stringY",
	"timeStamp":"{{todayDate}}",

My goal is to allow request to be forwarded to the pool only when "parameter2" equals "stringX" and "parameter3" equals "stringY". In all other cases I need to RST the connection.

I only have LTM (v13.1) at my disposition.

Had anyone successfully accomplished similar with iRule? Any help greatly appreciated.

Thanks.

  • Hi,

     

    From my perspective. In case you need iRule to inspect HTTP payload. It will impact system performance. Because iRule should be collect & scan HTTP payload.

     

    I'm not sure for your application can be change from validate JSON by validate HTTP header / HTTP cookie instead.