6

I wrote a simple file browser app which is served using node on port 3000. I use nginx as a front-end which proxies this service. This is on my home server.

I would like to be able to require basic HTTP authentication when I'm accessing it over my public IP, but not when I'm at home. I have this configuration:

location /files {
  satisfy any;
  allow 10.1.0.0/24;
  deny all;
  auth_basic "Authentication Required";
  auth_basic_user_file /etc/access_list;
  proxy_pass http://127.0.0.1:3000/;
}

However, this isn't working. When I'm on my home network on the same subnet, it is still requiring me to do the basic HTTP authentication. I had thought the order "allow > deny > auth" paired with "satisfy any" is correct. Am I doing anything wrong here? Is this possible?

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
NMS
  • 191
  • 7

1 Answers1

0

There is typo in above config. The connection is from 10.1.1.157, but the configuration file just allows from 10.1.0.0/24.

The fix is simple: Change the problematic line to the following one:

allow 10.1.1.0/24;
apaderno
  • 123
  • 9
masegaloeh
  • 17,978
  • 9
  • 56
  • 104