Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7760175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:48:49+00:00 2026-06-01T13:48:49+00:00

I would like to allow only one country access, but exclude proxies within this

  • 0

I would like to allow only one country access, but exclude proxies within this country.

This is what I have (shortened version for convenience)

<Limit GET POST>
order deny,allow
deny from all
allow from 139.82.0.0/16
allow from 143.54.0.0/16
allow from 186.192.0.0/11
allow from 186.224.0.0/11
.
deny from 186.201.27.66
deny from 186.201.196.1
deny from 186.214.51.231
deny from 186.237.225.26
</Limit>

But I know this wont work. How do I go about doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:48:50+00:00Added an answer on June 1, 2026 at 1:48 pm

    Update : for the new apache 2.4 jump directly to the end.

    The Order keyword and its relation with Deny and Allow Directives is a real nightmare. It would be quite interesting to understand how we ended up with such solution, a non-intuitive one to say the least.

    • The first important point is that the Order keyword will have a big impact on how Allow and Deny directives are used.
    • Secondly, Deny and Allow directives are not applied in the order they are written, they must be seen as two distinct blocks (one the for Deny directives, one for Allow).
    • Thirdly, they are drastically not like firewall rules: all rules are applied, the process is not stopping at the first match.

    You have two main modes:

    The Order-Deny-Allow-mode, or Allow-anyone-except-this-list-or-maybe-not

    Order Deny,Allow
    
    • This is an allow by default mode. You optionally specify Deny rules.
    • Firstly, the Deny rules reject some requests.
    • If someone gets rejected you can get them back with an Allow.

    I would rephrase it as:

    Rule Deny
         list of Deny rules
    Except
         list of Allow rules
    Policy Allow (when no rule fired)
    

    The Order-Allow-Deny-mode, or Reject-everyone-except-this-list-or-maybe-not

    Order Allow,Deny
    
    • This is a deny by default mode. So you usually specify Allow rules.
    • Firstly, someone’s request must match at least one Allow rule.
    • If someone matched an Allow, you can still reject them with a Deny.

    In the simplified form:

    Rule Allow
         list of Allow rules
    Except
         list of Deny rules
    Policy Deny (when no rule fired)
    

    Back to your case

    You need to allow a list of networks which are the country networks. And in this country you want to exclude some proxies’ IP addresses.

    You have taken the allow-anyone-except-this-list-or-maybe-not mode, so by default anyone can access your server, except proxies’ IPs listed in the Deny list, but if they get rejected you still allow the country networks. That’s too broad. Not good.

    By inverting to order allow,deny you will be in the reject-everyone-except-this-list-or-maybe-not mode.
    So you will reject access to everyone but allow the country networks and then you will reject the proxies. And of course you must remove the Deny from all as stated by @Gerben and @Michael Slade (this answer only explains what they wrote).

    The Deny from all is usually seen with order deny,allow to remove the allow by default access and make a simple, readable configuration. For example, specify a list of allowed IPs after that. You don’t need that rule and your question is a perfect case of a 3-way access mode (default policy, exceptions, exceptions to exceptions).

    But the guys who designed these settings are certainly insane.

    All this is deprecated with Apache 2.4

    The whole authorization scheme has been refactored in Apache 2.4 with RequireAll, RequireAny and RequireNone directives. See for example this complex logic example.

    So the old strange Order logic becomes a relic, and to quote the new documentation:

    Controling how and in what order authorization will be applied has been a bit of a mystery in the past

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to make my website to allow only one session at a
I would like to only allow certain validations within production vs other environments for
I have used this tutorial to make a website, but I would like that
I would like to allow the user to click within my UserControl and drag
i am making my own framework and would like to allow easy direct access
I have a ASP.NET 3.5 web application and I would like to allow users
I would like to make one numeric-only textbox. I'd like to then add that
We have a voting mechanism that we want to restrict to only allow one
I would like to have a My_Events page, which only display events that current
The url would be something like this: www.example.com/index.php?file=myFile.ext The filtering would only allow leters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.