Welcome! Log In Create A New Profile

Advanced

Re: Pass parameters though auth_request directive?

Maxim Dounin
November 18, 2013 07:32AM
Hello!

On Mon, Nov 18, 2013 at 03:40:16AM -0500, engenex wrote:

> Hi,
>
> I am try to implement a simple auth system using nginx,
> nginx-auth-request-module and php-fpm.
>
> I want to do the following:
> User requests http://myserver.com/content/file1.zip?key=12345
>
> location /content {
> auth_request /auth_http.php;
> # do some logic in auth_http.php then
> # depending on response from auth_http.php drop the connection or allow
> downloading
> {
>
> I can't get the parameters from the request URI to my auth_http.php using
> the auth_request directive.
> My simple auth_http.php to check for the key param:
>
> <?php
> $key = $_GET['key'];
> error_log("key is $key \n"); ?>
>
> This shows error in php log:
> PHP Notice: Undefined index: key in /usr/local/nginx/html/auth_http.php
>
> I also checked the sizeof $_GET and it is 0. Can someone help me please?

This is expected - as auth request is to "/auth_http.php", and
there is no query string in the subrequest. If you want to check
original request arguments, you have to check them explicitly.

Assuming default fastcgi_param configuration and php, original
request URI (with original query string aka request arguments)
should be available via $_SERVER['REQUEST_URI'].

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Pass parameters though auth_request directive?

engenex November 18, 2013 03:40AM

Re: Pass parameters though auth_request directive?

Maxim Dounin November 18, 2013 07:32AM

Re: Pass parameters though auth_request directive?

engenex November 18, 2013 10:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 188
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready