I’m trying to deny access to all locations on the server, unless the
user
has a specific IP address or enteres a password. This part is working.
I’m
also trying to add an exception, where any path starting with /Public is
allowed by anyone with no password. I’ve tried to override it in a
location
block, but this doesn’t seem to have any effect.
It matches the Public location, and produces:
access phase: 9
post access phase: 10
access forbidden by rule, client: xxx.xxx.xxx.xxx, server: www.myserver.com,
request: “GET /Public/ HTTP/1.1”, host: “www.myserver.com”.
Then it returns a 403 without a basic auth prompt. So It looks like the
rule
is ovverriding the basic auth prompt, but not the deny rule?
On Thu, Nov 06, 2014 at 04:47:28PM -0500, nrahl wrote:
Hi there,
With debug logging on, I ahve confirmed it is matching the correct location.
Do you also see the subrequest that accesses a different location that
has its own configration?
for basic authentication" durring the access phase.
Is that only if the file fake.html does not exist, so there is a new
request to the location @apache which does require authentication?
Or do you get unexpected output when the request is only handled in
this location?
You have denied access by ip address here, so 403 is the expected
response, no?
You may have more success if you can describe what response you expect,
and provide a complete (small) server{} configuration that demonstrates
the unwanted behaviour that you see.
You have denied access by ip address here, so 403 is the expected
response, no?
You may have more success if you can describe what response you
expect,
and provide a complete (small) server{} configuration that
demonstrates
the unwanted behaviour that you see.
The expected response is a password prompt on all locations, unless the
IP
matches, in which case allow, or the path starts with /Public, in which
case
allow.
On Thu, Nov 06, 2014 at 05:35:09PM -0500, nrahl wrote:
Hi there,
The expected response is a password prompt on all locations, unless the IP
matches, in which case allow, or the path starts with /Public, in which case
allow.
nginx config is based on “one request is handled in one location”;
but one http request is not necessarily just one nginx request.
I suspect that if you put the configuration that you want, in the
location
that you want, things will Just Work. Trying to have one location both
require and not require a password, is probably the root of the issue.
location ^~ /Public { # Disable access restriction on this location
auth_basic off;
(You will want to disable “deny all” or “satisfy any” here too.)
try_files fake.html @apache;
Instead of that try_files, can you just “proxy_pass” directly?
Either copy-paste the config ending with
proxy_pass http://127.0.0.1:8080;
or do “include the-proxy-pass-file;”?
}
location / { # All other requests get proxy passed to apache.
try_files fake.html @apache;
Same there, but that one is not directly influenced by the “satisfy
any” thing.
Thanks, I got it working. My goal was to avoid repeating both the proxy
config and the password blocks, but I was able to make them inlcudes to
avoid a bunch of duplicate lines.
Thanks again!
Posted at Nginx Forum:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.