<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mod rewrite &#8211; John Large &#8211; Technology, Hardware,Web Development, Digital Privacy &amp; Ethics</title>
	<atom:link href="https://www.johnlarge.co.uk/tag/mod-rewrite/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.johnlarge.co.uk</link>
	<description>I&#039;m a Computer science academic, working towards a PhD. I&#039;m researching digital privacy &#38; ethics. I also run a busy e-commerce business.</description>
	<lastBuildDate>Fri, 04 Sep 2026 08:44:19 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">6164056</site>	<item>
		<title>Blocking aggressive Chinese crawlers/scrapers/bots</title>
		<link>https://www.johnlarge.co.uk/blocking-aggressive-chinese-crawlers-scrapers-bots/</link>
					<comments>https://www.johnlarge.co.uk/blocking-aggressive-chinese-crawlers-scrapers-bots/#comments</comments>
		
		<dc:creator><![CDATA[John Large]]></dc:creator>
		<pubDate>Sun, 04 Aug 2019 10:35:11 +0000</pubDate>
				<category><![CDATA[Cybersecurity]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[mod rewrite]]></category>
		<category><![CDATA[spam]]></category>
		<guid isPermaLink="false">https://www.johnlarge.co.uk/?p=2232</guid>

					<description><![CDATA[Over the last few days I&#8217;ve had a massive increase in traffic from Chinese data centres &#38; ISPs. The traffic has been relentless &#38; the CPU usage on my server kept spiking enough to cause a fault in my cPanel hosting. I&#8217;m on a great hosting package with UKHOST4U and the server is fast &#38; [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="has-drop-cap wp-block-paragraph">Over the last few days I&#8217;ve had a massive increase in traffic from Chinese data centres &amp; ISPs. The traffic has been relentless &amp; the CPU usage on my server kept spiking enough to cause a fault in my cPanel hosting. I&#8217;m on a great hosting package with UKHOST4U and the server is fast &amp; stable, but it is shared with a few other websites. This means that I couldn&#8217;t just blanket ban Chinese IP ranges. Even though we don&#8217;t sell our products in China, it seemed like a very heavy-handed approach, and to block via .htaccess with the entire range of Chinese IP addresses was causing a 2-3 second delay in page parsing (pages normally load in around 600ms).</p>



<p class="wp-block-paragraph">First I tried blocking the individual IP&#8217;s, but this seemed to make the bot more aggressive &amp; requests went up as high as 800 every 30 seconds. The range of IP&#8217;s seemed endless, which seems to suggest some sort of bot farm or a whole range of compromised machines which are used for DDOS.</p>



<p class="wp-block-paragraph">&nbsp;</p>



<p class="wp-block-paragraph">After giving it some thought &amp; checking the raw access logs, I could see a pattern in the user agents being used by the malicious traffic. Below are a few examples of those user agents:-</p>



<p class="wp-block-paragraph">Mozilla/5.0(Linux;Android 5.1.1;OPPO A33 Build/LMY47V;wv) AppleWebKit/537.36(KHTML,link Gecko) Version/4.0 Chrome/42.0.2311.138 Mobile Safari/537.36 Mb2345Browser/9.0</p>



<p class="wp-block-paragraph">Mozilla/5.0 (Linux; Android 7.0; FRD-AL00 Build/HUAWEIFRD-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043602 Safari/537.36 MicroMessenger/6.5.16.1120 NetType/WIFI Language/zh_CN</p>



<p class="wp-block-paragraph">Mozilla/5.0(Linux;Android 5.1.1;OPPO A33 Build/LMY47V;wv) AppleWebKit/537.36(KHTML,link Gecko) Version/4.0 Chrome/43.0.2357.121 Mobile Safari/537.36 LieBaoFast/4.51.3</p>



<p class="wp-block-paragraph">Mozilla/5.0(Linux;U;Android 5.1.1;zh-CN;OPPO A33 Build/LMY47V) AppleWebKit/537.36(KHTML,like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.7.0.953 Mobile Safari/537.36</p>
<p>Mozilla/5.0 (Linux; Android 7.0;) AppleWebKit/537.36 (KHTML, like Gecko) Mobile Safari/537.36 (compatible; PetalBot;+https://aspiegel.com/petalbot)</p>



<p class="wp-block-paragraph">I broke down the user agents above &amp; added a new rule to my root .htaccess file as follows:-</p>



<pre class="wp-block-code"><code>Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} Mb2345Browser|LieBaoFast|zh-CN|MicroMessenger|zh_CN|Kinza|Datanyze|serpstatbot|spaziodati|OPPO\sA33|AspiegelBot|aspiegel|PetalBot [NC]
RewriteRule ^ - [F,L]</code></pre>



<p class="wp-block-paragraph">This rule uses a regular expression to block a user agent containing any of the following strings:-<br />Mb2345Browser<br />LieBaoFast<br />zh-CN<br />MicroMessenger<br />zh_CN<br />Kinza<br />OPPO A33<br />Aspeigel<br />PetalBot</p>



<p class="wp-block-paragraph">The first two seem to be used commonly by Chinese crawlers, but as mentioned earlier, we do not ship products to china, so I&#8217;m not worried about blocking those browsers. The ZH-CN strings refer to Chinese specific localization settings such as OS &amp; Interface language. Micromessneger is related to WeChat &#8211; but again, I&#8217;ve never had a customer browse/buy from within the WeChat app so that can be safely blocked. Finally, Kinza is related to Russian email spam. I believe the Kinza browser is an obscure Japanese browser, but on our site is commonly misused in the user agent string by Russian email spam.</p>



<p class="wp-block-paragraph">This seems to be quite a simple solution to block traffic. Many spammy users will have something in the user agent string which isn&#8217;t common to the popular browsers such as chrome, safari &amp; Firefox on common devices. You will have to cater this to your own websites needs, but I&#8217;ve no doubt I&#8217;ll be adding other reg ex arguments from obscure user agents in the future to keep malicious users off the site.</p>



<p class="wp-block-paragraph">I hope this helps &amp; if you have anything to add, please get in touch or leave a comment.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.johnlarge.co.uk/blocking-aggressive-chinese-crawlers-scrapers-bots/feed/</wfw:commentRss>
			<slash:comments>60</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2232</post-id>	</item>
	</channel>
</rss>
