# Auth request module 0.2

**URL:** <https://www.ruby-forum.com/t/auth-request-module-0-2/185685>\
**Category:** NGINX\
**Created:** [March 24, 2010, 5:09pm UTC](https://www.ruby-forum.com/t/auth-request-module-0-2/185685 "2010-03-24T17:09:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [March 24, 2010, 5:09pm UTC](https://www.ruby-forum.com/t/auth-request-module-0-2/185685/1 "2010-03-24T17:09:05Z")

</div>

Hello!

Changes with auth request module 0.2 (2010-03-24):

```
*) Feature: auth_request_set directive.

*) Bugfix: segmentation fault happened on auth request handled by
   proxy_pass or fastcgi_pass if initial request has non-empty body.

```

Further info is here:

[http://mdounin.ru/hg/ngx\_http\_auth\_request\_module/](http://mdounin.ru/hg/ngx_http_auth_request_module/)  
[http://mdounin.ru/files/ngx\_http\_auth\_request\_module-0.2.tar.gz](http://mdounin.ru/files/ngx_http_auth_request_module-0.2.tar.gz)

MD5 (ngx\_http\_auth\_request\_module-0.2.tar.gz) =  
46b7c636d0734c87fa9563089e536bc9  
SHA256 (ngx\_http\_auth\_request\_module-0.2.tar.gz) =  
eea5d0ec02bba93d0b204a034230cc61462b60497cbac6f581d7e008a9262ba4

Maxim D.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [June 21, 2011, 4:43pm UTC](https://www.ruby-forum.com/t/auth-request-module-0-2/185685/2 "2011-06-21T16:43:51Z")

</div>

I’m having problems using this module for POST requests. GET works fine  
and it’s really awesome, but POST requests end-up timing out. Anybody  
experience the same thing?

Posted at Nginx Forum:

> **[Re: \[ANNOUNCE\] auth request module 0.2](https://forum.nginx.org/read.php?2,67425,208738#msg-208738)**
>
> Hello! Changes with auth request module 0.2 (2010-03-24): \*) Feature: auth\_request\_set directive. \*) Bugfix: segmentation fault happened on auth request handled by proxy\_pass or fastcgi\_pass if initial request has non-empty body.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [June 21, 2011, 7:01pm UTC](https://www.ruby-forum.com/t/auth-request-module-0-2/185685/3 "2011-06-21T19:01:43Z")

</div>

Hello!

On Tue, Jun 21, 2011 at 10:43:13AM -0400, adamchal wrote:

> I’m having problems using this module for POST requests. GET works fine  
> and it’s really awesome, but POST requests end-up timing out. Anybody  
> experience the same thing?

Please make sure you use

```
proxy_set_header Content-Length "";

```

as suggested by README if you use proxy\_pass to handle auth  
subrequests.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [June 21, 2011, 8:38pm UTC](https://www.ruby-forum.com/t/auth-request-module-0-2/185685/4 "2011-06-21T20:38:50Z")

</div>

Hello!

On Tue, Jun 21, 2011 at 02:00:21PM -0400, adamchal wrote:

> OK, you’re absolutely right. I didn’t have that line in there. I’m  
> trying to follow the reasoning for needing to zero-out request body, but  
> it doesn’t make immediate sense. Is the OP in this thread along the  
> same lines? [http://forum.nginx.org/read.php?2,206860](http://forum.nginx.org/read.php?2,206860)

Auth request doesn’t read request body, and subrequest used for  
auth will have no body but the same headers as original request.  
Thus it’s needed to clear Content-Length if you are going to  
proxy\_pass auth subrequest somewhere.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [June 21, 2011, 8:01pm UTC](https://www.ruby-forum.com/t/auth-request-module-0-2/185685/5 "2011-06-21T20:01:08Z")

</div>

OK, you’re absolutely right. I didn’t have that line in there. I’m  
trying to follow the reasoning for needing to zero-out request body, but  
it doesn’t make immediate sense. Is the OP in this thread along the  
same lines? [subrequest and POST](http://forum.nginx.org/read.php?2,206860)

Posted at Nginx Forum:

> **[Re: \[ANNOUNCE\] auth request module 0.2](https://forum.nginx.org/read.php?2,67425,208798#msg-208798)**
>
> Hello! Changes with auth request module 0.2 (2010-03-24): \*) Feature: auth\_request\_set directive. \*) Bugfix: segmentation fault happened on auth request handled by proxy\_pass or fastcgi\_pass if initial request has non-empty body.

---

<div class="post-metadata">

**Author:** ![Maxim\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@Maxim\_D](https://www.ruby-forum.com/u/Maxim_D)\
**Post date:** [June 21, 2011, 10:53pm UTC](https://www.ruby-forum.com/t/auth-request-module-0-2/185685/6 "2011-06-21T22:53:32Z")

</div>

I actually got this working with the built-in memcache and userid  
modules. This is REALLY cool and I’m going to be re-thinking how to  
provide security/authentication in other projects using this approach.  
Thanks for the quick feedback and your hard work Maxim.

Here’s a snippet of my configuration:

server {  
…  
auth\_request /auth;

```
location = /auth {
  auth_request off;
  set $memcached_key sso$cookie_uid;
  memcached_pass mmc:11211;
  error_page 404
                        =403 /login.html;
}
location = /login.php {
  auth_request off;
  # fastcgi_param
  fastcgi_pass unix:/var/lib/php.sock;
}
...

```

}

Note: this example uses PHP/FastCGI instead of proxy\_pass.

Posted at Nginx Forum:

> **[Re: \[ANNOUNCE\] auth request module 0.2](https://forum.nginx.org/read.php?2,67425,208847#msg-208847)**
>
> Hello! Changes with auth request module 0.2 (2010-03-24): \*) Feature: auth\_request\_set directive. \*) Bugfix: segmentation fault happened on auth request handled by proxy\_pass or fastcgi\_pass if initial request has non-empty body.
