Computer ???
No. 508
Name. swindler
Subject. apache 2.4 + tomcat User-Agent 차단
Main Cate. Linux
Sub Cate.
Date. 2024-05-22 11:15
Hit. 931 (121.134.199.74)
File.
아파치 설정파일에 다음과 같은 형태로 bad_bot을 지정함


SetEnvIfNoCase User-Agent ".*MJ12bot.*" bad_bot
SetEnvIfNoCase User-Agent ".*AhrefsBot.*" bad_bot


디렉토리 설정에 다음과 같이 차단 처리

<Directory /home/project/xxx/>
Order Allow,Deny
Allow from all
Deny from env=bad_bot
</Directory>


curl로 테스트

curl -i -X POST -H "User-Agent: MJ12bot" https://www.xxx.io/


-> access_log에 로그가 찍히는데 403 Forbidden 으로 차단됨



tomcat을 사용하는 경우 jsp 페이지는 정상적으로 HTTP_CODE 200 으로 리턴된다.


[바로가기 링크] : http://coolx.net/cboard/computer/508



Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox