iptables TCP Rules

Because HTTP is plain text and HTTPS in encrypted.

That aside, I would seriously suggest not using this method for blocking specific user agents - it should be done within the web server itself.