wordpress - Redirect loop on attempted web proxy -
i have apache server running wordpress in web root (/var/www/html
). in access_log have been seeing many entries of form:
98.209.16.114 - - [15/feb/2013:21:19:51 -0500] "get http://www.twitter.com http/1.1" 301 - "-" "curl/7.28.1" 98.209.16.114 - - [15/feb/2013:21:19:51 -0500] "get http://www.twitter.comhttp/www.twitter.com http/1.1" 301 - "-" "curl/7.28.1" 98.209.16.114 - - [15/feb/2013:21:19:51 -0500] "get http://www.twitter.comhttphttp/www.twitter.comhttp/www.twitter.com http/1.1" 301 - "-" "curl/7.28.1" 98.209.16.114 - - [15/feb/2013:21:19:52 -0500] "get http://www.twitter.comhttphttphttp/www.twitter.comhttphttp/www.twitter.comhttp/www.twitter.com http/1.1" 301 - "-" "curl/7.28.1"
where www.twitter.com
can replaced number of odd domains external own.
edit: copied lines include curl because testing phenomenon own command line.
the pertinent lines in httpd.conf
file are:
namevirtualhost *:80 <virtualhost *:80> documentroot /var/www/html servername www.mydomain.com <directory /var/www/html> allowoverride </directory> </virtualhost> <virtualhost *:80> servername mydomain.com rewriteengine on rewriterule ^/(.*) http://www.mydomain.com/$1 [l,r=301] </virtualhost>
and .htaccess
file in wordpress directory looks like:
<ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule>
this happens tens of times per day. few questions have are:
should worried many proxy attempts? i've turned off mod_proxy , while http requests looping, https requests seem homecoming either301
or 400
is there sort of performance loss should worried about? how prepare darn thing? let me know other info need.
the modules need loaded apache wordpress following... excludes php module , i'll explain bit more after:
loadmodule authz_host_module modules/mod_authz_host.so loadmodule log_config_module modules/mod_log_config.so loadmodule expires_module modules/mod_expires.so loadmodule deflate_module modules/mod_deflate.so loadmodule env_module modules/mod_env.so loadmodule setenvif_module modules/mod_setenvif.so loadmodule mime_module modules/mod_mime.so loadmodule autoindex_module modules/mod_autoindex.so loadmodule dir_module modules/mod_dir.so loadmodule alias_module modules/mod_alias.so loadmodule rewrite_module modules/mod_rewrite.so loadmodule negotiation_module modules/mod_negotiation.so loadmodule headers_module modules/mod_headers.so
depending on whether running php fcgi or php mod_php (prefork) include 1 of following:
#---- fpm of php enable both below , disable php5_module loadmodule fastcgi_module modules/mod_fastcgi.so loadmodule actions_module modules/mod_actions.so #---- standard php5 module enable below , disable 2 above #loadmodule php5_module modules/libphp5.so
the redirects i'm seeing based on log output looks more badly configured mod_rewrite rule, or 301 redirect plugin in wordpress conflicting rules on apache.
now general rule of thumb, when host namevirtualhost based vhosts, create default vhost servername default
and set it's doc root directory includes 1 html file , rewrite rule transfer traffic index.html (the html file outputs hosted by) way filter out of garbage traffic isn't based on domain itself, , since it's running html doesn't require iops based on php it's static html only.
that way vhost handle requests domain hosts. doesn't prepare issue 301's happening. if can share mod_rewrite configuration perhaps there in there can help with.
the biggest problem i've seen in community ssl based traffic when developers have integrate load balancers ssl certificate truncated on load balancer instead of apache. said can no longer rewrite status / rule check if https != on, redirect 301 new location load balancer terminates cert , sends http (port 80) traffic webhost apache think it's unencrypted though hits secured vhost
one additional note on vhost. it's improve not utilize .htaccess files unless absolutely have to. wordpress vhost directory element should optimal performance.
<virtualhost *:80> servername www.example.com documentroot /path/to/doc_root <directory /path/to/doc_root/> allowoverride none options symlinksifownermatch multiviews -indexes order allow,deny allow rewriteengine on rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^.*$ index.php [l] </directory> </virtualhost>
the reason why optimal performance .htaccess file not read apache on every single request comes it. instead reads part vhost config , saves configuration in memory save huge amount on iops not having utilize .htaccess in add-on additional security of not having rely on .htaccess files , overrides.
and using rewritebase irrelevant , causes prolems unless host wordpress under specific alias /blog/ in case based on .htaccess file appears on base of operations domain there no need have directive in there. reference see rewrite rules have in vhost config above.
wordpress apache mod-rewrite redirect mod-proxy
No comments:
Post a Comment