WebFaction
Community site: login faq

I'm hoping to block bots with a .htaccess condition like RewriteCond %{HTTP_USER_AGENT} Yandex. From what I've found, that may not be possible given a dynamic custom app (written in GO) on a shared server. Are there any alternatives?

asked 26 Nov '14, 17:27

emadera52
116
accept rate: 0%


Your custom app runs behind our front-end Nginx service.

You can't use .htaccess files, since that's only supported by Apache.

It looks like the golang http module has a Request.UserAgent function that you can use, so it ought to be simple to build user agent blocking into your application.

permanent link

answered 26 Nov '14, 20:42

seanf
12.2k41836
accept rate: 37%

I found the .htaccess file in my $HOME directory. I've added the RewriteCond and will monitor logs to see if the Yandex bot is blocked.

(26 Nov '14, 20:44) emadera52

It won't, but best of luck anyway :)

(26 Nov '14, 20:53) seanf

I though I'd responded yesterday... must have forgot to click "comment". In any case, your response helps. I agree that it should be easy to add a filter for incoming requests. Thanks for your help.

(27 Nov '14, 19:49) emadera52

You're very welcome!

(27 Nov '14, 19:52) seanf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×33
×21
×19

question asked: 26 Nov '14, 17:27

question was seen: 1,766 times

last updated: 27 Nov '14, 19:52

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM