0

i am doing some load testing on apache and i gets tons of internal dummy connections

::1 219 - [22/Dec/2011:11:02:57 +0000] "OPTIONS * HTTP/1.0" 200 181 "-" "Apache (internal dummy connection)" ::1 221 - [22/Dec/2011:11:02:58 +0000] "OPTIONS * HTTP/1.0" 200 181 "-" "Apache (internal dummy connection)" ::1 188 - [22/Dec/2011:11:02:59 +0000] "OPTIONS * HTTP/1.0" 200 181 "-" "Apache (internal dummy connection)" ::1 243 - [22/Dec/2011:11:03:03 +0000] "OPTIONS * HTTP/1.0" 200 181 "-" "Apache (internal dummy connection)" ::1 215 - [22/Dec/2011:11:03:04 +0000] "OPTIONS * HTTP/1.0" 200 181 "-" "Apache (internal dummy connection)" ::1 178 - [22/Dec/2011:11:03:05 +0000] "OPTIONS * HTTP/1.0" 200 181 "-" "Apache (internal dummy connection)" 

This is the virtual host config:

NameVirtualHost *:80 RewriteEngine on RewriteCond %{HTTP_USER_AGENT} ^.*internal dummy connection.*$ [NC] RewriteRule ^/$ /blank.html [L] <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/vhosts/domain/html ServerName domain ErrorLog /var/www/vhosts/domain/error_log SetEnvIf REMOTE_ADDR "(.+)" CLIENTIP=$1 SetEnvIf X-Forwarded-For "^([0-9.]+)" CLIENTIP=$1 LogFormat "%{CLIENTIP}e %D %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" trueip_combined CustomLog "/var/www/vhosts/domain/access_log" trueip_combined <Directory /var/www/vhosts/domain/html> Options -Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> 

To solve this i am readirecting all internal dummy connections to blank.html using the rewrite rule, but it give me a error in syntax?

[root@ip-10-56-1-98 ~]# /etc/init.d/httpd configtest Syntax error on line 3 of /etc/httpd/conf.d/vhosts.conf: RewriteCond: bad flag delimiters 

Any ideas?

2 Answers 2

2

You need to escape the spaces like:

RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC] 
5
  • the syntax worked, but i still get the same errors on access log Commented Dec 22, 2011 at 11:51
  • What do you mean by "worked but get the same errors on access log"? Commented Dec 22, 2011 at 11:59
  • means it still logs the error "interal dummy error" and does not redirect to blank.html Commented Dec 22, 2011 at 13:08
  • You may consider simplifying that condition. I see no reason why you need to test for the full UA string here, and it's complicating things. Consider: RewriteCond %{HTTP_USER_AGENT} ^Apache [NC] instead. Commented Dec 22, 2011 at 14:11
  • i have now put the rules in the virtualhost config and that works.. thanks for the help Commented Dec 23, 2011 at 9:44
0

Solution that works for me

Replace

CustomLog "logs/access_log" combined 

With

SetEnvIf Remote_Addr "::1" loopback SetEnvIf Remote_Addr "127\.0\.0\.1" loopback CustomLog logs/access_log combined env=!loopback 

Source

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.