W
W
weranda2018-03-07 11:53:49
Apache HTTP Server
weranda, 2018-03-07 11:53:49

Apache has two variables - SetEnvIfNoCase and BrowserMatchNoCase. Which one is better/faster?

Greetings

I read and do not understand the difference in the speed of the two variables:

  1. SetEnvIfNoCase;
  2. BrowserMatchNoCase.

The first, as I understand it, looks for / takes several parameters at once and you can choose which parameter is needed (user-agent, host, and others), and the second looks for / takes only user-agent. Abstracting, it turns out that if you need to use one of the rules in the .htaccess file, then the first user-agent search option (SetEnvIfNoCase) will perform at least one operation more (search for all data and extract user-agent from them ), while the second option (BrowserMatchNoCase) has only one operation. And in the first case, more resources will be spent (saving on matches, but still, I'm interested).

I'm trying to choose one of several options for blocking unwanted bots, and because of the superficial view of how Apache works, it's hard to decide.

There are such options:
# вариант 1
SetEnvIfNoCase User-Agent "yandex.ru" fuck_you
SetEnvIfNoCase User-Agent "google.ru" fuck_you
...
Deny from env=fuck_you

# вариант 2
BrowserMatchNoCase "yandex.ru" fuck_you
BrowserMatchNoCase "google.ru" fuck_you
...
Deny from env=fuck_you

# есть еще другие варианты, но хотелось бы получить представление о работе именно этих двух.

What do you advise?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question