Restrict/Deny access to all paths starting with _

Hi,
this is probably a noob question but i’m wondering what would be the
best
way to

allow access to a directory e.g.:

location /foo {

}

this will allow access to

/foo
/foo/bar
/foo/bar/somefile.txt

But now i want to deny access to everything starting with /foo/_

/foo/_

so for example

/foo/_users
/foo/_secrets/something.htm
etc.

those should not be accessible.
What is the most efficient way to do this?
Thx
Patrick

Hi,

Smrchy wrote:

this will allow access to

/foo
/foo/bar
/foo/bar/somefile.txt

But now i want to deny access to everything starting with /foo/_
location /foo {

}

location ^~ /foo/_ {
return 403;
}

should do the trick (and should be the most efficient I believe).

Marcus.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs