I think you are confusing between url-rewrite and location On Sat, Apr 8, 2017 at 6:39 PM, Ajay Garg <ajaygargn...@gmail.com> wrote:
> Hi All. > > When I setup the following, the authentication+proxying works perfect, > with the url changing from http://1.2.3.4:2001 to > http://1.2.3.4:2001/cgi-bin/webproc, and the proxied0server opening up > perfectly. > > ############################################################ > ################ > server { > listen 2001; > location / { > > auth_basic 'Restricted'; > auth_basic_user_file /home/ > 2819163155b64c4c81f8608aa23c9faa/.htpasswd; > proxy_pass http://127.0.0.1:2000; > } > } > ############################################################ > ################# > > > > However, I am not able to do the proxying if I perform url-rewriting. > Nothing of the following works :: > > a) > ############################################################ > ################ > server { > listen 2001; > location /78 { > > auth_basic 'Restricted'; > auth_basic_user_file /home/ > 2819163155b64c4c81f8608aa23c9faa/.htpasswd; > proxy_pass http://127.0.0.1:2000; > } > } > ############################################################ > ################ > > No URL change happens, and 404 (illegal-file-access) is obtained. > > > b) > ############################################################ > ################ > server { > listen 2001; > location /78 { > > auth_basic 'Restricted'; > auth_basic_user_file /home/ > 2819163155b64c4c81f8608aa23c9faa/.htpasswd; > proxy_pass http://127.0.0.1:2000/; > } > } > ############################################################ > ################ > > No URL change happens, and 404 (illegal-file-access) is obtained. > > > c) > ############################################################ > ################ > server { > listen 2001; > location /78/ { > > auth_basic 'Restricted'; > auth_basic_user_file /home/ > 2819163155b64c4c81f8608aa23c9faa/.htpasswd; > proxy_pass http://127.0.0.1:2000/; > } > } > ############################################################ > ################ > > The URL does changes from http://1.2.3.4:2001/78 to > http://1.2.3.4:2001/cgi-bin/webproc, but a 404 is obtained. > > > d) > ############################################################ > ################ > server { > listen 2001; > location /78/ { > > auth_basic 'Restricted'; > auth_basic_user_file /home/ > 2819163155b64c4c81f8608aa23c9faa/.htpasswd; > proxy_pass http://127.0.0.1:2000; > } > } > ############################################################ > ################ > > No URL change happens, and 404 (illegal-file-access) is obtained. > > > So, I guess c) is the closest to doing a url-rewrite, but I wonder why am > I getting a 404, even though the URL-change is perfect. > > > Any ideas please? > > > Thanks and Regards, > Ajay > > _______________________________________________ > nginx mailing list > nginx@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx > -- *Anoop P Alias*
_______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx