1

I have a django website project deployed in an enviroment from AWS Beanstalk. I'm trying write configs to apache block access to a specific path (/admin). I avoid change wsgi.conf file, instead I writing package.config in .ebextensions folder, like following:

"/etc/httpd/conf.d/block_admin.conf":
  mode: "000644"
  owner: root
  group: root
  content: |
  <Location /admin>
     <RequireAll>
         Require ip <my_ip>/32
         Require all denied
     </RequireAll>
  </Location>

That code is denying all access to "/admin", include from my ip. I get my ip from services like what is my ip.

What am i doing wrong?

PS: My english is a working in progress....

[edit]

I tryed change the order of Require(all denied/ip) directives

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Paulo Vinícius
  • 326
  • 2
  • 9
  • Have you searched the web before ? looks like https://stackoverflow.com/questions/4400154/deny-all-allow-only-one-ip-through-htaccess or even https://serverfault.com/questions/714887/how-to-forbid-access-to-admin-url-path-in-apache-config-by-ip-subnet – LoneWanderer Nov 19 '18 at 19:24
  • Thanks, but i ask here after some hours (or days) from search here or in internet. That linked question is from 2010 and his recently answers not help me or bring a new solution. – Paulo Vinícius Nov 19 '18 at 19:44

1 Answers1

0

You shouldn't use <RequireAll> or multiple Require directives at all, simply Require ip 1.2.3.4. If it continues to fail, read the error_log entry closely each time.

covener
  • 17,402
  • 2
  • 31
  • 45