Using Rewrite to block host name

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 6
Joined: 03 Nov 2014, 09:50

Using Rewrite to block host name

05 Nov 2014, 12:07

Hi,

Is there a way using isapi to block host names?
i.e. i want to forward or block all traffic from shark.tothsoft.hu etc.

Thanks!

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Using Rewrite to block host name

05 Nov 2014, 19:09

Hello,

Do you mean you want to block all traffic coming from a specific web-site? I'd suppose you'll need %{HTTP_REFERER} variable. Let me know if you have any questions.

Regards

User avatar
Posts: 6
Joined: 03 Nov 2014, 09:50

Re: Using Rewrite to block host name

05 Nov 2014, 23:39

Hello,

No, i mean blocking/forwardind all traffic from a specific Hostname / ISP.

ie. cmo73.neoplus.adsl.tpnet.pl wich is the host name of 83.31.142.73
or hosting.warkeeper.net wich is the hostname of 195.2.240.101.

Thanks.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Using Rewrite to block host name

06 Nov 2014, 14:29

I believe I've given you the right answer, if I understood the task correctly.
If not, you can always look up needed variable from here - http://www.helicontech.com/isapi_rewrit ... teCond.htm

Regards
Andrew

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Using Rewrite to block host name

06 Nov 2014, 14:30

I'd also suggest taking a look at our examples section - http://www.helicontech.com/isapi_rewrit ... amples.htm and FAQ - http://www.helicontech.com/articles/mod_rewrite-faq/

Regards

User avatar
Posts: 6
Joined: 03 Nov 2014, 09:50

Re: Using Rewrite to block host name

06 Nov 2014, 17:24

I use the HTTP_REFERER, it's great for redirecting traffic from a website.

But i was asking about redirecting a HOST NAME of some ISP.
For example: static.75.32.4.46.clients.your-server.de
or: 204023.n.ncyu.edu.tw etc.

I did some tests using the HTTP_HOST + the host name i need to redirect -
but not working :cry:

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Using Rewrite to block host name

07 Nov 2014, 12:48

I believe this is the first time I see a request like this. Tried to do some research and it seems liek people do not block by ISP, it needs to be an IP range. Which we have described here - http://www.helicontech.com/articles/mod_rewrite-faq/

User avatar
Posts: 6
Joined: 03 Nov 2014, 09:50

Re: Using Rewrite to block host name

07 Nov 2014, 20:45

thanks anyway, i appreciate your effort.

PS. there is a way doing it in Apache, using a map:
RewriteEngine on
RewriteMap hosts-deny txt:/path/to/hosts.deny
RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^ - [F]

And in the map "hosts.deny" so:
bsdti1.sdm.de -
another.host.name -


Question if maps like host.deny will work using ISAPI on iis/win.
Thanks again.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Using Rewrite to block host name

10 Nov 2014, 11:16

Well, why didn't you tell that you have an example like this.
Surely it'll work. The mapfiles syntax is quite similar and should work, there's more about mapfiles in FAQ under 'Comprehensive Mapfile Insight'.

I believe it should work. If it doesn't we'd need to see rewrite.log for the request in question.

Regards

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 5 guests