Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account
List archives

trying to ban IPs using htaccess - not working

Apache - Client Max Out
(13 lines)
what threads and processes apache needs to run
(12 lines)
Jul 23, 2010
Bennett Haselton
Bennett Haselton
I'm trying to ban certain IPs from visiting my site, so that they 
instead see a message saying "Your IP has been banned, email me if 
you think this is an error."  I've *almost* got it working -- when 
people visit URLs like
http://209.160.28.154/index.html
or
http://209.160.28.154/foo-does-not-exist
they see the "banned IP" message.  However, the problem is that if 
you try to access the front page:
http://209.160.28.154/
from a banned IP address, you see the "Apache Test Page for CentOS" 
page, instead of seeing the "banned IP" message.  Anybody recognize 
this problem or have an idea of what could be causing it?

In my httpd.conf file, I changed "AllowOverride None" to 
"AllowOverride All" in both the default <Directory /> tag and inside

the <Directory "/var/www/html"> tag -- I placed a modified copy of 
httpd.conf at:
http://209.160.28.154/httpd.conf
and in /var/www/html I placed a .htaccess file containing these lines:
 >>>
ErrorDocument 403 /banned_ip.php
order deny,allow
deny from 71.112.32.149
 >>>
and restarted the server.  (The page 
http://209.160.28.154/banned_ip.php shows the message you're supposed 
to see when connecting from a banned IP.  71.112.32.149 is my home 
machine IP which I've "banned" for testing purposes.)

So like I said, that almost works, where 
http://209.160.28.154/index.html gives the right error message, but 
http://209.160.28.154/ does not.  Any idea how to change is to that 
all URLs under http://209.160.28.154/ will give the "banned IP" 
message if connecting from a banned IP?

	-Bennett



Reply
Tags: visitingbanurlspeople
Messages in this thread
trying to ban IPs using htaccess - not working
Similar Threads
loglevel in htaccess with a new override?
Are there any hurdles to allowing the new LogLevel in htaccess perhaps
with a new override to protect it?

This would be great for the poor shared hosting rewrite users who
could never enable the old rewritelog.




Re: .htaccess deny question
Post the complete case including the order statement. Also i dont think you
need the backslashes.

Sent from my phone

On Jun 24, 2010 1:38 AM, "Industrial Blue"
<industri### @yahoo.com> wrote:

I'm having a heck of a time trying to get this to work.  I have a
.htaccess
file which is working fine.  I now have a requirement to restrict/deny any
server ending with the letter 'n' from example.com

For example, I want to deny the server 123n.example.com but still allow
all
other servers (not ending in 'n') from example.com

I have tried everything like:

deny from *n\.example\.com
deny from .*n\.example\.com
deny from ^*n\.example\.com

Is what I am trying to do outside the scope of allow/deny?  Thanks much.







.htaccess deny question
I'm having a heck of a time trying to get this to work.  I have a .htaccess
file which is working fine.  I now have a requirement to restrict/deny any
server ending with the letter 'n' from example.com

For example, I want to deny the server 123n.example.com but still allow
all other servers (not ending in 'n') from example.com

I have tried everything like:

deny from *n\.example\.com
deny from .*n\.example\.com
deny from ^*n\.example\.com

Is what I am trying to do outside the scope of allow/deny?  Thanks much.



      



still see .htaccess and .htpasswd trough virtual host
Hello list,

I have become little confused and hope to get some help. I have a suse
11.2 server running   Apache/2.2.10 (Linux/SUSE) with some virtual hosts.
I already have the following in httpd.conf file

``````````````
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
    Order allow,deny
        Deny from all
</Files>
``````````````````````````

But still I can read the .htaccess and .htpasswd file through browser,
when visit the virtual host. But if I add the above config at the virtual
host itself, it works well. So the virtualhosts bypass the config already
there in httpd.conf.  Do I need to write the code for each and every
virtualhost then ? Not possible to define at any common point just once ?

Please let me know,
Thanks


users@httpd] How to prevent flashgot by .htaccess ?
Hello list,

Can any one suggest me the signature of flashgot as seen by apache ? I
need that to prevent flashgot from .htaccess. I have already tried by

tail -f /var/log/apache/access.log

but have not found anything which can be used to detect flashgot.

Thanks





htaccess and httpd.conf precedence (mod_deflate)
Hi everybody,

I'm running a Apache installation using a standard DirectAdmin setup, but
I'm having problems with handling of gzipped output.

One of my PHP scripts outputs a .ZIP file (with appropriate headers). By
default, the output of this script gets gzipped by mod_deflate. Of course
there is no need to gzip a zip file, but decent browsers have no problem
handling this. Internet Explorer mangles the file though, unless you set a
non standard content type.

So, in order to fix this and disable gzip for this script, I've set up a
line in my .htaccess file:

SetEnvIf Request_URI download_file\.php$ no-gzip dont-vary

When I test this using wget (wget --header="Accept-Encoding:
gzip,deflate") this works fine. Output from this script does not get
gzipped. However, if I add the IE user agent header (User-Agent:
Mozilla/4.0 (compatible; MSIE 6.0;.....) the content still gets gzipped.

Strangely, when I replace the above line with 'SetEnv no-gzip', the
content does not get gzipped even though I send the IE user agent header.
I've traced this back to the stock httpd-deflate.conf which is included in
my httpd.conf. It contains the following line:

BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

When I comment this line out, things work as expected... does, for some
reason, a BrowserMatch reffered from httpd.conf have precedence over what's
in a .htaccess file? Any suggestions? I could change my httpd.conf, but
when the site for instance gets moved to a different server this problem
might rear it's ugly head again...

Thanks!





users@httpd] .htaccess redirect issue
Hello list,

I am trying to achieve a very particular .htaccess redirect arrangement.
I have made it worked but halfway :-(

I have written a redirect rule as

`````````````````
RewriteCond %{HTTP_HOST} ^testyou.mydomain.com
RewriteRule ^(.*)$ http://www.mydomain.com\?domain=testyou.mydomain.com
[R=301,L]

`````````````````````````

So http://testyou.mydomain.com should redirect to
http://www.mydomain.com\?domain=testyou.mydomain.com

But with the above rule the link redirects to

http://www.mydomain.com\?=testyou.mydomain.com

So without the *domain* in between.

Could any one suggest to

[1] how can I fixed this so the *domain* appears like
http://www.mydomain.com\?domain=testyou.mydomain.com

[2] Can there be any arrangement so that I can use bulk redirection ?
Say putting a variable in place of testyou.mydomain.com , so that those
two rules can effectively redirect all subdomains pointed to that server
? I don't know if it really possible. Any sugestion/clue please ?

Thanks





DO NOT REPLY htaccess: Require "nobody"/none
https://issues.apache.org/bugzilla/show_bug.cgi?id=16801

Nick Kew <ni### @webthing.com> changed:

           What    |Removed                     |Added

Working C example?
Hi, looking in the  http://activemq.apache.org/c-integration.html C
cross-client  implementations  
http://svn.apache.org/repos/asf/activemq/sandbox/openwire-c/ OpenWire  and

http://svn.stomp.codehaus.org/browse/stomp/trunk/c/ STOMP  C
implementations, I see only prototype code, which project would be most
easy
to get running though?

Does anyone have a working example or experience building one of the
prototype C implementations (possibly with brief build/run
instructions)???

It would be GREATLY appreciated! I need to get a JMS consumer/producer
going
using C, like yesterday!!




Caching not working
Hi,

I have got a proxy running using ATS. The sole entry in remap.config is -

map http://localhost:8080/ http://localhost:8282/

However caching does not take place. Every query i make is redirected to
the
origin server. The contents of storage.config is -

/usr/local/trafficserver/cache 134217728

A cache.db file in that location exists. But, the value of the cache size
-
proxy.process.cache.bytes_total is shown as 0. What do I need to do to
make
caching work?

Thanks,
Pranav.


SSL Not working on tomcat 5.5.29
Hi All,

I am working on upgrading tomcat from 5.5.28 to 5.5.29 for one of the
applications. I see that the website renders and works fine in 5.5.29 on
port 8080 (non SSL) but with  SSL (port 8443) the website doesnot run at
all. When I try to see what's going on in Fiddle, I see 502 error. Also
nothing is written to the log flies. It is as if tomcat is not even
running
in port 8443.

Under tomcat 5.5.28, the site renders fine with SSL and non SSL.

Is there something I could be missing?

Regards,
Kareem




Re: anyone working on BCEL ?
On 24/05/2010, Mark Thomas <mar### @apache.org> wrote:
 On 24/05/2010 22:34, sebb wrote:
  > Is anyone working on - or wanting to work on - BCEL at present?


 Try the Jakarta dev list. BCEL isn't a commons component.

Duh -sorry!

  Mark


  >
  > I know that Findbugs are keen to get away from using their
patched version.
  >
  > I can do some tidying up of test cases and basic warnings if
that would help.
  >
  > There seem to have been a lot of fixes since 5.2, so it would
be good
  > to get a new release out.
  >

 > 
FileUpload not working
Hi guys,

I'm using the Apache Commons FileUpload lib and I'm getting this strange
behaviour in just one of my servers. All others work perfectly.

servletfileupload.parseRequest(request) always returns an empty list.

But if I check for:

ServletFileUpload.isMultipartContent(request)

This returns true. So, the list should not be empty.

I'm really stuck here. Any ideas?

Thanks,
Fernando




Desperate for working AMQ-cpp for VS2005
I am having a terrible time with amq-cpp 3.2.x on VS2005. I used MPC to 
generate the missing VS 2005 files and everything rebuilt ok but there are

still problems:

in Debug mode my app fails to link with the error fatal error LNK1106: 
invalid file or disk full

in Release mode it linked but blew up with a core dump as soon as it tried

to use AMQ (not sure which call).

I think there may be still something wrong with my build env but I do not 
know what. I note that I have to link with the APR libraries. I thought 
these were C libraries so I took prebuilts from sourceforge. Do I need to 
do my own build of these as well. I am wondering if the C++ macros I am 
forced to use also have to be enabled here. They are:

  macros += WIN32
  macros += _WINDOWS
  macros += NOMINMAX

  macros += _SECURE_SCL_THROWS=1
  macros += _SECURE_SCL=1
  macros += _CRT_SECURE_NO_DEPRECATE
  macros += _CRT_NONSTDC_NO_DEPRECATE
  macros += _MBCS

  macros += _VC80_UPGRADE=0x0600

I assumed I wouldn't need these since the APR is coded in C. However, I 
now remember that VS does not provide a separate C compiler. One has to 
run C code through the C++ compiler so maybe these macros might have an 
effect.

I would really appreciate a release of AMQ-cpp with VS files for VS2005.

Regards,

Andrew Marlow


Working example MyBatis 3.0 web application
http://mybatis.googlecode.com/svn/sub-projects/contact_manager

The development stack is stripes+guice+mybatis+hsqldb+junit4+mockito.

It's using a couple of new features:
 - package level configuration by convention available in the
programmatic config API
 - and the new SqlSessionManager (available in the current snapshot
and will be in the next release)

Feel free to check it out and build the war file.  Only have to drop
it into any container and you are good to go.  We have changed it from
pgSql to an in memory DB (hsqldb) to make life even easier.

More to come!  When I get a chance I will add a few more simple table
to show joins and other common features.

MyBatis Team


Puppet_Augeas: Working Examlples
Hello Puppeteers;

for those of us who are still suffering in the darkness of
Puppet_Augeas,
I put  a couple of working examples here:

http://projects.puppetlabs.com/projec...iki/Puppet_Augeas

and those of us who are no longer in the dark, please add there your
working examples - for enlightenment, you know :-)

Thank you;

Andrei





tomcat /manager not working
I downloaded tomcat 5.5.29 and tried to access an application
http://<IP of Tomcat server>:8080/manager
which the doc says
http://tomcat.apache.org/tomcat-5.5-d...v/deployment.html
that it is included and deployed by default it did not showed me any
thing did I miss any thing.




Group by is not working with Filter
Hello Everyone,

I am trying to execute below mentioned script, but it is throwing error.
Script is:

A = load 'ex_groupby' USING PigStorage(',') as (a1:int,a2:int,a3:int);
G1 = GROUP A by (a1,a2);
describe G1;
*D = Filter G1 by group.$0 > 1;*
dump D;

Error is :

java.lang.ClassCastException: java.lang.Integer cannot be cast to
org.apache.pig.data.Tuple
        at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject.getNext(POProject.java:389)
        at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.processInput(PhysicalOperator.java:276)
        at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject.getNext(POProject.java:138)
        at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POProject.getNext(POProject.java:276)
        at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.GreaterThanExpr.getNext(GreaterThanExpr.java:72)
        at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POFilter.getNext(POFilter.java:148)
        at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator.processInput(PhysicalOperator.java:276)
        at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POLocalRearrange.getNext(POLocalRearrange.java:259)
        at
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapBase.runPipeline(PigMapBase.java:236)
        at
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapBase.map(PigMapBase.java:231)
        at
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapBase.map(PigMapBase.java:53)
        at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:144)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:621)

Any help would be appreciated.

Thanks,
Swati


Simple mybatis3 working example
I just created a very simple example (java konsole output, using
mysql) with the help of mybatis3 user guide,
adding some knowledge I got from ibatis3.

You can check it out from:
https://pl3.projectlocker.com/razorblue/mybatis3_example/svn

using this account
username: gue### @fakemail.com
password: 123456

Hope this helps