How to create IP blacklist in Symfony2?

前端 未结 6 1242
刺人心
刺人心 2021-02-08 17:53

Yes, I know there\'s Voter tutorial in cookbook. But I\'m looking for something slightly different. I need two different layers of blacklisting:

  1. deny certain IP to
6条回答
  •  别跟我提以往
    2021-02-08 18:32

    For site-wide IP restrictions it's best to handle them at the apache level, so your app does not even get hit by the request. In case you are trying to keep out a spammer, this way you don't waste any resources on their sometimes automated requests. In your case, writing the deny rules to the .htaccess file would be appropriate. In larger setups you can also configure a firewall to block specific IPs so those requests don't even hit your server at all.

提交回复
热议问题