You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ajay Garg <aj...@gmail.com> on 2017/04/08 05:11:39 UTC

[users@httpd] ProxyPass and ProxyPassReverse not working for URLs other than /

Hi All.


When I have the following configuration :

#########################################################
<VirtualHost *:80>
        ProxyPass / http://127.0.0.1:9000/
        ProxyPassReverse / http://127.0.0.1:9000/
</VirtualHost>
#########################################################

and I type http://1.2.3.4 in the browser, the page is successfully proxied
to the forwarded port 9000, and the to-and-fro interaction is perfect.



However, if I use,

#########################################################
<VirtualHost *:80>
        ProxyPass /9000/ http://127.0.0.1:9000/
        ProxyPassReverse /9000/ http://127.0.0.1:9000/
</VirtualHost>
#########################################################

and I type http://1.2.3.4/9000/ in the browser, it says the resource cannot
be found.


How can this be corrected? I am sure I am doing something wrong while
specifying the ProxyPass and ProxyPassReverse directives.


Thanks and Regards,
Ajay

[users@httpd] Re: ProxyPass and ProxyPassReverse not working for URLs other than /

Posted by Ajay Garg <aj...@gmail.com>.
Hi All.

Following works perfect, http://1.2.3.4:2001 perfectly gets changed to the
proxied-url http://1.2.3.4:2001/cgi-bin/webproc, and the proxied-site can
be worked upon perfectly !!

###########################################################################################
Listen 2001
<VirtualHost *:2001>

        <Location "/">
            AuthType Basic
            AuthName "Restricted Content"
            AuthUserFile /home/2819163155b64c4c81f8608aa23c9faa/.htpasswd
            Require valid-user

            ProxyPass http://127.0.0.1:2000/
            ProxyPassReverse http://127.0.0.1:2000/
        </Location>

</VirtualHost>
############################################################################################



However, if I try

###########################################################################################
Listen 2001
<VirtualHost *:2001>

        <Location "/2000">
            AuthType Basic
            AuthName "Restricted Content"
            AuthUserFile /home/2819163155b64c4c81f8608aa23c9faa/.htpasswd
            Require valid-user

            ProxyPass http://127.0.0.1:2000/
            ProxyPassReverse http://127.0.0.1:2000/
        </Location>

</VirtualHost>
############################################################################################

and hit the url http://1.2.3.4:2001/2000, the url does get changed to
http://1.2.3.4:2001/cgi-bin/webproc, but a 404 is obtained (with the text
"The requested URL /cgi-bin/webproc was not found on this server." in
Firefox).


Any ideas how to do proper proxying for locations other than "/"?
This is important, else we will have to open one-port-per-location, instead
of using one-port for all locations.


Will be grateful for help.



Thanks and Regards,
Ajay



On Sat, Apr 8, 2017 at 10:41 AM, Ajay Garg <aj...@gmail.com> wrote:

> Hi All.
>
>
> When I have the following configuration :
>
> #########################################################
> <VirtualHost *:80>
>         ProxyPass / http://127.0.0.1:9000/
>         ProxyPassReverse / http://127.0.0.1:9000/
> </VirtualHost>
> #########################################################
>
> and I type http://1.2.3.4 in the browser, the page is successfully
> proxied to the forwarded port 9000, and the to-and-fro interaction is
> perfect.
>
>
>
> However, if I use,
>
> #########################################################
> <VirtualHost *:80>
>         ProxyPass /9000/ http://127.0.0.1:9000/
>         ProxyPassReverse /9000/ http://127.0.0.1:9000/
> </VirtualHost>
> #########################################################
>
> and I type http://1.2.3.4/9000/ in the browser, it says the resource
> cannot be found.
>
>
> How can this be corrected? I am sure I am doing something wrong while
> specifying the ProxyPass and ProxyPassReverse directives.
>
>
> Thanks and Regards,
> Ajay
>



-- 
Regards,
Ajay