Welcome! Log In Create A New Profile

Advanced

Re: URL-Rewriting not working

Anoop Alias
April 08, 2017 09:42AM
The 404 is thrown by whatever is working on port 2000 ;so you can check its
access log and see


On Sat, Apr 8, 2017 at 6:54 PM, Ajay Garg <ajaygargnsit@gmail.com> wrote:

> Hi Anoop.
>
> As per http://serverfault.com/questions/379675/nginx-
> reverse-proxy-url-rewrite, the rewrite should be automatic.
> But it does not work for me :(
>
> On Sat, Apr 8, 2017 at 6:49 PM, Anoop Alias <anoopalias01@gmail.com>
> wrote:
>
>> I think you are confusing between url-rewrite and location
>>
>> On Sat, Apr 8, 2017 at 6:39 PM, Ajay Garg <ajaygargnsit@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
>>
>
>
>
> --
> 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
Subject Author Posted

URL-Rewriting not working

Ajay Garg April 08, 2017 09:12AM

Re: URL-Rewriting not working

Anoop Alias April 08, 2017 09:20AM

Re: URL-Rewriting not working

Ajay Garg April 08, 2017 09:26AM

Re: URL-Rewriting not working

Anoop Alias April 08, 2017 09:42AM

Re: URL-Rewriting not working

Ajay Garg April 08, 2017 09:46AM

Re: URL-Rewriting not working

Francis Daly April 09, 2017 06:50AM

Re: URL-Rewriting not working

Ajay Garg April 09, 2017 07:58AM

Re: URL-Rewriting not working

Francis Daly April 09, 2017 08:30AM

Re: URL-Rewriting not working

Ajay Garg April 09, 2017 08:48AM

Re: URL-Rewriting not working

Ajay Garg April 09, 2017 09:08AM

Re: URL-Rewriting not working

Francis Daly April 09, 2017 11:18AM

Re: URL-Rewriting not working

Ajay Garg April 09, 2017 11:38AM

Re: URL-Rewriting not working

Lucas Rolff April 09, 2017 11:48AM

Re: URL-Rewriting not working

Ajay Garg April 10, 2017 12:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 141
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