# Basic\_auth for parts of uwsgi

**URL:** <https://www.ruby-forum.com/t/basic-auth-for-parts-of-uwsgi/228568>\
**Category:** NGINX\
**Created:** [April 28, 2013, 1:06pm UTC](https://www.ruby-forum.com/t/basic-auth-for-parts-of-uwsgi/228568 "2013-04-28T13:06:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christoph\_Egger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/d26b3c/32.png) [@Christoph\_Egger](https://www.ruby-forum.com/u/Christoph_Egger)\
**Post date:** [April 28, 2013, 1:06pm UTC](https://www.ruby-forum.com/t/basic-auth-for-parts-of-uwsgi/228568/1 "2013-04-28T13:06:25Z")

</div>

Hi!

I have the following problem:

I’m running a uwsgi application using nginx on /. I would like to add  
authentication for /foo/ and /bar/. However neither

> location /bar/ {  
> auth\_basic “LOGIN”;  
> auth\_basic\_user\_file “/tmp/test/”;  
> }

nor

> ```
> auth_basic "LOGIN";
> auth_basic_user_file "/tmp/test/bar";
> 
> ```
> 
> }  
> }

Seem to pass /foo/ and /bar/ to the wsgi socket and I can’t find a  
solution on the interwebz.

```
Christoph

```

–  
9FED 5C6C E206 B70A 5857 70CA 9655 22B9 D49A E731  
Debian Developer | Lisp Hacker | CaCert Assurer

---

<div class="post-metadata">

**Author:** ![Christoph\_Egger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/d26b3c/32.png) [@Christoph\_Egger](https://www.ruby-forum.com/u/Christoph_Egger)\
**Post date:** [April 28, 2013, 1:21pm UTC](https://www.ruby-forum.com/t/basic-auth-for-parts-of-uwsgi/228568/2 "2013-04-28T13:21:02Z")

</div>

On Sun, Apr 28, 2013 at 01:05:37PM +0200, Christoph Egger wrote:

Hi there,

> I’m running a uwsgi application using nginx on /. I would like to add  
> authentication for /foo/ and /bar/.

One request is handled in one location.

In the one location that handles the request “/foo/something”, you want  
to have both “auth\_basic” and “uwsgi\_pass”.

In the one location that handles the request “/not-foo/something”, you  
want to have “uwsgi\_pass” but not “auth\_basic”.

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
