Error using Apache proxy - affects other pages Shopping List v.163 and some other pages.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Error using Apache proxy - affects other pages Shopping List v.163 and some other pages.

Tom-75
I get to MH by accessing   http://www.mydomainname.com/mh/  ( Notice the
/mh/ )

I am using Apache with ProxyPass to forward external traffic to MH with
the following information:

  <Location /mh/>
    RewriteEngine on
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
    RewriteRule .* - [F]
    Allow from all
    ProxyPass  http://10.0.0.91:80/
    ProxyPassReverse  http://10.0.0.91:80/
    AllowOverride None
    AuthType Basic
    AuthName "Authorised MisterHouse User"
    AuthUserFile /data/passwords/passwords
    require user misterhouse
  </Location>

The latest version of shopping_list.pl   v-1.63

contains the following line:
<form name="main" action="/bin/shopping_list.pl" method="post">

Previous versions contained:
<form name="main">

What seems to be messing with this and some other pages is my need to
end the domain with /mh/

I can do either of the following to get it to work properly from
outside.. (it works with either)
Replace the line with
<form name="main">
of
<form name="main" action="/mh/bin/shopping_list.pl" method="post">

Am I setting up Apache incorrectly or is that just how MH works and it
doesn't like my use of /mh/

TiVo Web Plus includes a Prefix directive which takes this into account.
The same setup works for TiVo, but the configuration file includes the
following:
Prefix = tivo

Is there something similar for MH?

thanks,
tom



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error using Apache proxy - affects other pages Shopping List v.163 and some other pages.

Matthew Williams-2
Sorry about introducing the change in the shopping list.  I did it to make
the page valid HTML.  However, the problem is a general one, and not limited
to the shopping list.

Reverse proxy is very good, but does has the limitation that you mention
below.  But don't worry, there is a solution.

First, a quick explanation of what reverse proxy does for those that don't
know.  It retrieves web pages from internal web pages and sends them to
external web clients, rewriting the _HTTP_ headers so that the page appears
to originate from an externally addressable place.  It does NOT rewrite URLs
embedded within the page - the page remains as is.  This is what is screwing
up your access.

What happens is that the HTTP header says that the page is from
/mh/bin/shopping_list.pl and the embedded link says to go to
/bin/shopping_list.pl, which the reverse proxy engine ignores because it is
does not begin with /mh.

You need to use mod_proxy_html (http://apache.webthing.com/mod_proxy_html/).
 It does the same thing as mod_proxy, but rewrites the contents of html
pages so that links are correctly rewritten.  I'm really not sure why it
isn't included in standard Apache builds as it is a very necessary component
of putting together a fully functional reverse proxy.

In your case, you would need to load the module and then change your conf
file to the following.  For more info, see the tutorial pointed to within
the above web site.

BTW, I'll add this to the wiki, as it is a commonly experienced problem.

ProxyRequests off
ProxyPass /mh/ http://10.0.0.91:80/
ProxyHTMLURLMap http://10.0.0.91:80/ /mh

<Location /mh/>
        RewriteEngine on
        RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
        RewriteRule .* - [F]
               
        ProxyPassReverse /
        SetOutputFilter proxy-html
        ProxyHTMLURLMap / /mh/
        ProxyHTMLURLMap /mh /mh
        RequestHeader unset Accept-Encoding
               
        Allow from all
        AllowOverride None
        AuthType Basic
        AuthName "Authorised MisterHouse User"
        AuthUserFile /data/passwords/passwords
        require user misterhouse
</Location>

Matt

Tom wrote:

> I get to MH by accessing   http://www.mydomainname.com/mh/  ( Notice the
> /mh/ )
>
> I am using Apache with ProxyPass to forward external traffic to MH with
> the following information:
>
>  <Location /mh/>
>    RewriteEngine on
>    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
>    RewriteRule .* - [F]
>    Allow from all
>    ProxyPass  http://10.0.0.91:80/
>    ProxyPassReverse  http://10.0.0.91:80/
>    AllowOverride None
>    AuthType Basic
>    AuthName "Authorised MisterHouse User"
>    AuthUserFile /data/passwords/passwords
>    require user misterhouse
>  </Location>
>
> The latest version of shopping_list.pl   v-1.63
>
> contains the following line:
> <form name="main" action="/bin/shopping_list.pl" method="post">
>
> Previous versions contained:
> <form name="main">
>
> What seems to be messing with this and some other pages is my need to
> end the domain with /mh/
>
> I can do either of the following to get it to work properly from
> outside.. (it works with either)
> Replace the line with
> <form name="main">
> of
> <form name="main" action="/mh/bin/shopping_list.pl" method="post">
>
> Am I setting up Apache incorrectly or is that just how MH works and it
> doesn't like my use of /mh/
>
> TiVo Web Plus includes a Prefix directive which takes this into account.
> The same setup works for TiVo, but the configuration file includes the
> following:
> Prefix = tivo
>
> Is there something similar for MH?
>
> thanks,
> tom
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> ________________________________________________________
> To unsubscribe from this list, go to:
> http://sourceforge.net/mail/?group_id=1365
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error using Apache proxy - affects other pages Shopping List v.163 and some other pages.

Tom-75
Thanks.. it works great.

> Sorry about introducing the change in the shopping list.  I did it to make
> the page valid HTML.  However, the problem is a general one, and not limited
> to the shopping list.
>
> Reverse proxy is very good, but does has the limitation that you mention
> below.  But don't worry, there is a solution.
>
> First, a quick explanation of what reverse proxy does for those that don't
> know.  It retrieves web pages from internal web pages and sends them to
> external web clients, rewriting the _HTTP_ headers so that the page appears
> to originate from an externally addressable place.  It does NOT rewrite URLs
> embedded within the page - the page remains as is.  This is what is screwing
> up your access.
>
> What happens is that the HTTP header says that the page is from
> /mh/bin/shopping_list.pl and the embedded link says to go to
> /bin/shopping_list.pl, which the reverse proxy engine ignores because it is
> does not begin with /mh.
>
> You need to use mod_proxy_html (http://apache.webthing.com/mod_proxy_html/).
>  It does the same thing as mod_proxy, but rewrites the contents of html
> pages so that links are correctly rewritten.  I'm really not sure why it
> isn't included in standard Apache builds as it is a very necessary component
> of putting together a fully functional reverse proxy.
>
> In your case, you would need to load the module and then change your conf
> file to the following.  For more info, see the tutorial pointed to within
> the above web site.
>
> BTW, I'll add this to the wiki, as it is a commonly experienced problem.
>
> ProxyRequests off
> ProxyPass /mh/ http://10.0.0.91:80/
> ProxyHTMLURLMap http://10.0.0.91:80/ /mh
>
> <Location /mh/>
> RewriteEngine on
> RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
> RewriteRule .* - [F]
>
> ProxyPassReverse /
> SetOutputFilter proxy-html
> ProxyHTMLURLMap / /mh/
> ProxyHTMLURLMap /mh /mh
> RequestHeader unset Accept-Encoding
>
> Allow from all
> AllowOverride None
> AuthType Basic
> AuthName "Authorised MisterHouse User"
> AuthUserFile /data/passwords/passwords
> require user misterhouse
> </Location>
>
> Matt
>
> Tom wrote:
>  
>> I get to MH by accessing   http://www.mydomainname.com/mh/  ( Notice the
>> /mh/ )
>>
>> I am using Apache with ProxyPass to forward external traffic to MH with
>> the following information:
>>
>>  <Location /mh/>
>>    RewriteEngine on
>>    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
>>    RewriteRule .* - [F]
>>    Allow from all
>>    ProxyPass  http://10.0.0.91:80/
>>    ProxyPassReverse  http://10.0.0.91:80/
>>    AllowOverride None
>>    AuthType Basic
>>    AuthName "Authorised MisterHouse User"
>>    AuthUserFile /data/passwords/passwords
>>    require user misterhouse
>>  </Location>
>>
>> The latest version of shopping_list.pl   v-1.63
>>
>> contains the following line:
>> <form name="main" action="/bin/shopping_list.pl" method="post">
>>
>> Previous versions contained:
>> <form name="main">
>>
>> What seems to be messing with this and some other pages is my need to
>> end the domain with /mh/
>>
>> I can do either of the following to get it to work properly from
>> outside.. (it works with either)
>> Replace the line with
>> <form name="main">
>> of
>> <form name="main" action="/mh/bin/shopping_list.pl" method="post">
>>
>> Am I setting up Apache incorrectly or is that just how MH works and it
>> doesn't like my use of /mh/
>>
>> TiVo Web Plus includes a Prefix directive which takes this into account.
>> The same setup works for TiVo, but the configuration file includes the
>> following:
>> Prefix = tivo
>>
>> Is there something similar for MH?
>>
>> thanks,
>> tom
>>
>>
>>
>> -------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
>> files
>> for problems?  Stop!  Download the new AJAX search engine that makes
>> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
>> ________________________________________________________
>> To unsubscribe from this list, go to:
>> http://sourceforge.net/mail/?group_id=1365
>>
>>
>>    
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com 
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> ________________________________________________________
> To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365
>
>
>
>  




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365

Reply | Threaded
Open this post in threaded view
|

Re: Error using Apache proxy - affects other pages Shopping List v.163 and some other pages.

David Mark
In reply to this post by Matthew Williams-2
Matthew Williams <mattrwilliams <at> users.sourceforge.net> writes:

>
> Sorry about introducing the change in the shopping list.  I did it to make
> the page valid HTML.  However, the problem is a general one, and not limited
> to the shopping list.
>
> Reverse proxy is very good, but does has the limitation that you mention
> below.  But don't worry, there is a solution.
>
> First, a quick explanation of what reverse proxy does for those that don't
> know.  It retrieves web pages from internal web pages and sends them to
> external web clients, rewriting the _HTTP_ headers so that the page appears
> to originate from an externally addressable place.  It does NOT rewrite URLs
> embedded within the page - the page remains as is.  This is what is screwing
> up your access.
>
> What happens is that the HTTP header says that the page is from
> /mh/bin/shopping_list.pl and the embedded link says to go to
> /bin/shopping_list.pl, which the reverse proxy engine ignores because it is
> does not begin with /mh.

If you put an shtml wrapper around this script, then you can use a relative
link.  It is the root reference that is causing the problem with the proxy.  
Basically, the form isn't portable now.

My version looks like this after an environment variable is substituted with
the shtml filename:

<form name="main" action="shopping_list.shtml" method="post">

This is compliant and will not interfere with the proxy.  And of course it
will be a step toward making the shopping module compliant with my version of
http_server.




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365