Block specific URL's in APM

we have requirement to block particular URL’s and URI.

can we block URL and URI in the APM provisioned F5 device.

Thanks,

RK

Yes you can, even with just LTM

try something like this

when HTTP_REQUEST
{
    switch -glob [ string tolower [HTTP::uri] ]
    {
        "/uri1" -
        "/uri2"
        {
            drop
        }
        default
        {}
    }
}

Hi @rkram_p ,

if you really want to use APM, you could use Per-Request Polices. Do as Kostas said, use iRules instead.

Cheers
Daniel

Hi @Injeyan_Kostas ,

Thank you for your response. can we use same format for to block whole URL?

Thanks

RK

you can try somthing like this

when HTTP_REQUEST
{
	switch -glob [ string tolower [HTTP::host] ]
    {
        "test.example.com"
		{
			switch -glob [ string tolower [HTTP::uri] ]
			{
				"/uri1" -
				"/uri2"
				{
					drop
				}
				default
				{}
			}
		}
		"test2.example.com"
		{
			switch -glob [ string tolower [HTTP::uri] ]
			{
				"/uri3" -
				"/uri4"
				{
					drop
				}
				default
				{}
			}
		}
		default
		{}	
    }
}

You can also use Local Traffic Policy. I try to only use iRule if a Local Traffic Policy can not be effective.  Less CPU cost.

GUI path: Local Traffic → Policies → Policy List → Create

Use these settings:

  • Name: block_specific_url
  • Strategy: first-match (recommended for deterministic behavior)