Questions about proxy_pass and internal directives

mrtn nginx-forum at nginx.us
Thu Oct 18 19:28:15 UTC 2012


Hello,

My question is two-part:

1. given the following setup:

root    /home/www/mysite/static;

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

Why a request for "mysite.com/foo/bar/sth.html" does not get proxied to the
server at "127.0.0.1:8080"? Instead, the file
"/home/www/mysite/static/foo/bar/sth.html" is served.

2. is there a way to use 'internal' directive together with 'proxy_pass' for
the same location? e.g. 

root    /home/www/mysite/static;

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

I've tried with the above, but it seems 'internal' directive takes
precedence, and just return 404 immediately. What I want to achieve is to
block direct access to files under "/home/www/mysite/static/foo/bar", and
proxy all requests to an application server which will decide the access.

Any suggestion? Thank you.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,231998,231998#msg-231998



More information about the nginx mailing list