<div dir="ltr">I think you are confusing between url-rewrite and location</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 8, 2017 at 6:39 PM, Ajay Garg <span dir="ltr"><<a href="mailto:ajaygargnsit@gmail.com" target="_blank">ajaygargnsit@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div>Hi All.<br><br></div>When I setup the following, the authentication+proxying works perfect, with the url changing from <a href="http://1.2.3.4:2001" target="_blank">http://1.2.3.4:2001</a> to <a href="http://1.2.3.4:2001/cgi-bin/webproc" target="_blank">http://1.2.3.4:2001/cgi-bin/<wbr>webproc</a>, and the proxied0server opening up perfectly.<br><br>##############################<wbr>##############################<wbr>################<br>server {<br>        listen 2001;<br>        location / {<br><br>                        auth_basic 'Restricted';<br>                        auth_basic_user_file /home/<wbr>2819163155b64c4c81f8608aa23c9f<wbr>aa/.htpasswd;<br>                        proxy_pass <a href="http://127.0.0.1:2000" target="_blank">http://127.0.0.1:2000</a>;<br>                }<br>        }<br>##############################<wbr>##############################<wbr>#################<br><br><br><br></div>However, I am not able to do the proxying if I perform url-rewriting.<br></div>Nothing of the following works ::<br><br></div>a)<br>##############################<wbr>##############################<wbr>################<br>server {<br>        listen 2001;<br>        location /78 {<br><br>                        auth_basic 'Restricted';<br>                        auth_basic_user_file /home/<wbr>2819163155b64c4c81f8608aa23c9f<wbr>aa/.htpasswd;<br>                        proxy_pass <a href="http://127.0.0.1:2000" target="_blank">http://127.0.0.1:2000</a>;<br>                }<br>        }<br>##############################<wbr>##############################<wbr>################<br><br></div>No URL change happens, and 404 (illegal-file-access) is obtained.<br><br><br></div>b)<br>##############################<wbr>##############################<wbr>################<br>server {<br>        listen 2001;<br>        location /78 {<br><br>                        auth_basic 'Restricted';<br>                        auth_basic_user_file /home/<wbr>2819163155b64c4c81f8608aa23c9f<wbr>aa/.htpasswd;<br>                        proxy_pass <a href="http://127.0.0.1:2000/" target="_blank">http://127.0.0.1:2000/</a>;<br>                }<br>        }<br>##############################<wbr>##############################<wbr>################<br clear="all"><div><div><div><div><div><div><div><br>No URL change happens, and 404 (illegal-file-access) is obtained.<br><br><br></div><div>c)<br>##############################<wbr>##############################<wbr>################<br>server {<br>        listen 2001;<br>        location /78/ {<br><br>                        auth_basic 'Restricted';<br>                        auth_basic_user_file /home/<wbr>2819163155b64c4c81f8608aa23c9f<wbr>aa/.htpasswd;<br>                        proxy_pass <a href="http://127.0.0.1:2000/" target="_blank">http://127.0.0.1:2000/</a>;<br>                }<br>        }<br>##############################<wbr>##############################<wbr>################<br clear="all"><br>The URL does changes from <a href="http://1.2.3.4:2001/78" target="_blank">http://1.2.3.4:2001/78</a> to <a href="http://1.2.3.4:2001/cgi-bin/webproc" target="_blank">http://1.2.3.4:2001/cgi-bin/<wbr>webproc</a>, but a 404 is obtained.<br><br><br></div><div>d)<br></div><div>##############################<wbr>##############################<wbr>################<br>server {<br>        listen 2001;<br>        location /78/ {<br><br>                        auth_basic 'Restricted';<br>                        auth_basic_user_file /home/<wbr>2819163155b64c4c81f8608aa23c9f<wbr>aa/.htpasswd;<br>                        proxy_pass <a href="http://127.0.0.1:2000" target="_blank">http://127.0.0.1:2000</a>;<br>                }<br>        }<br>##############################<wbr>##############################<wbr>################<br clear="all"><br>No URL change happens, and 404 (illegal-file-access) is obtained.<br><br><br></div><div>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.<br><br><br></div><div>Any ideas please?<br></div><div><br><br><div class="m_5633751355435447435gmail_signature">Thanks and Regards,<br>Ajay<br></div>
</div></div></div></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><b>Anoop P Alias</b> <div><br></div></div></div></div>
</div>