I want to block access to urls that have excess characters at its end.
E.g. I want nginx to block requests to https://www.example.com/url-pattern/amp/extra-chars/more-extra
but want it to allow https://www.example.com/url-pattern/amp
or https://www.example.com/url-pattern/amp/
Will this work?
location .*\/amp\/. {
deny all
}
Please guide.