Welcome! Log In Create A New Profile

Advanced

Re: Questions about proxy_pass and internal directives

October 18, 2012 08:08PM
Reinis Rozitis Wrote:
-------------------------------------------------------
> You are using 'internal' in a wrong way (at least judging from your
> configuration excerpts).
>
> If you read the documentation
> http://nginx.org/en/docs/http/ngx_http_core_module.html#internal you
> should
> see that internal locations can't be accessed directly from
> client/browser
> but need some sort of _internal_ redirect.
>
>
>
> If there is a need for a backend application to check for permissions
> but
> serve the file from nginx (while the same time denying direct access)
> one
> way to do it is making the backend application to send
> 'X-Accel-Redirect'
> header ( some examples: http://wiki.nginx.org/XSendfile ).

That's exactly what I am doing.

location ^~ /foo/bar/ {
internal;
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
}

I use "internal" directive to block direct access to anything "/foo/bar/,,,", which seems to be what nginx is doing. At the same time, I proxy_pass the request to the backend application server to check for permissions. If success, the backend server sends a 'X-Accel-Redirect' header back to nginx to serve the file.

Now the problem is proxy_pass does not seem to work, as no request is being proxied to the backend server. I wondered if this is because I put it together with "internal" directive inside the location block, but from here: http://wiki.nginx.org/X-accel, it seems that this combination should be fine, as it is given as an example.

I'm scratching my head now...
SubjectAuthorPosted

Questions about proxy_pass and internal directives

mrtnOctober 18, 2012 03:28PM

Re: Questions about proxy_pass and internal directives

mrtnOctober 18, 2012 03:54PM

Re: Questions about proxy_pass and internal directives

VBartOctober 18, 2012 04:24PM

Re: Questions about proxy_pass and internal directives

mrtnOctober 18, 2012 04:32PM

Re: Questions about proxy_pass and internal directives

Reinis RozitisOctober 18, 2012 04:56PM

Re: Questions about proxy_pass and internal directives

mrtnOctober 18, 2012 06:18PM

Re: Questions about proxy_pass and internal directives

mrtnOctober 18, 2012 06:48PM

Re: Questions about proxy_pass and internal directives

Reinis RozitisOctober 18, 2012 07:38PM

Re: Questions about proxy_pass and internal directives

mrtnOctober 18, 2012 08:08PM

Re: Questions about proxy_pass and internal directives

mrtnOctober 18, 2012 08:38PM

Re: Questions about proxy_pass and internal directives

VBartOctober 18, 2012 08:40PM

Re: Questions about proxy_pass and internal directives

Reinis RozitisOctober 18, 2012 09:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 52
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready