You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Rafa Pérez <ra...@gmail.com> on 2005/05/24 15:01:29 UTC

Problems with proxy

Hi all. I have been trying to proxy lenya with mod_proxy following the
instructions given in
http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya_continued.html
but I have not succeeded (only the live side of a publication).
The pages are served, but the have not any style, they are served only
as text and links, and images are not displayed too. I have the
following configuration in my apache's config file:

<VirtualHost *:80>

        ServerName   mypub.com

        ProxyRequests Off
        RewriteEngine On

        DirectoryIndex index.html

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPass / http://localhost:8080/lenya/mypub/live/
        ProxyPassReverse / http://localhost:8080/lenya/mypub/live/
        # this is needed for css, etc.
        RewriteRule ^/$ index.html [R]
        RewriteRule ^/lenya/mypub/live/(.*)$ $1 [R,L]
        RewriteRule ^/lenya(.*) http://localhost:8080/lenya/mypub/live/$1 [P]

        # Rewrite for Lenya-wide resources (e.g. 404 page)
        RewriteRule ^/lenya/(.*) http://localhost:8080/lenya/$1 [P]
        RewriteRule ^/([^/\.]+)/(.*) http://localhost:8080/$1/live/$2 [P]

        CustomLog /var/log/apache2/gruposfa-access.log combined
        ErrorLog /var/log/apache2/gruposfa-error.log

</VirtualHost>

I am using lenya-1.2.3 on tomcat-5.0.28, and I have deployed lenya in
${TOMCAT_HOME}/webapps/lenya. Does anyone know what is wrong?

Thank you

Rafa

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Problems with proxy

Posted by sito <vr...@uib.es>.
Has anybody found the answer to this problem?

Thanks!

Rafa Pérez wrote:

>On 6/2/05, Rafa Pérez <ra...@gmail.com> wrote:
>  
>
>>>I have no answer simple answer to your question. I propose the following
>>>procedure:
>>>- empty you rewrite-log
>>>- access the index page one time and having a look at the page source in
>>>order to get the path to your css
>>>- ater that I would analyse your rewrite log especially what is happening
>>>with the css-request.
>>>
>>>BTW it is important the your publication.xconf file is matched to your
>>>RewriteRule.
>>>
>>>      
>>>
>>My fault again. I had changed the url in my publication.xconf several
>>times to make it work and I forgot to put the correct one in the last
>>test. I changed it and everything is working fine. Thank you for all
>>your help Jann.
>>    
>>
>
>Hi again. After some time trying some things with my proxy
>configuration here I am again.
>First of all, it seems that if are defined some rewriting rules in the
>apache configuration file, it is not necesary to change the
>publication.xconf at all. In fact, I have done this and it works, so I
>wonder why should it be necesary to change that file?
>Otherwise, I have deployed my publication in tomcat under the ROOT
>context of the servlet engine (as explained in
>http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya.html)
>and I realized about some problems when trying to make the proxying
>for the live side of the site:
>    * The pages shown in the first level of the publication (as the
>index page of the site) search for the css and the project-logo in
>"/lenya/{pub}/live/css/page.css"  and 
>"/lenya/{pub}/live/images/project-logo.jpg".
>    * The pages shown in the second level look for the same files in
>"../css/page.css" and "../images/projecto-logo.jpg"
>
>This behaviour makes that the rewrite rules given in
>http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya_continued.html
>are not completely correct to make it work properly. E.g. if I am
>trying to make apache serves the pages as http://www.client.com/mypub
>(and I have deployed under the ROOT context in tomcat), I need to
>change
>
>                    # Rewrite for Lenya-wide resources (e.g. 404 page) 
>                    RewriteRule ^/lenya/(.*)
>http://www.client.com:8080/lenya/$1 [P]
>to
>                    RewriteRule ^/lenya/(.*) http://www.client.com:8080/$1 [P]
>
>On the other hand, if I configure apache to serve the pages through
>http://www.mypub.com, I need to change the rewrite rules to make them
>appear in the following order:
>        RewriteRule ^/$ index.html [R]
>        RewriteRule ^/gruposfa/live/(.*)$ $1 [R,L]
>        #This is one of the rules for the Lenya-wide resources. It must
>        #be write as it appears in the tutorial
>        RewriteRule ^/lenya/(.*) http://localhost:8080/lenya/$1 [P]
>
>        RewriteRule ^/(.*) http://localhost:8080/gruposfa/live/$1 [P]        
>
>        # Rewrite for Lenya-wide resources (e.g. 404 page)
>        RewriteRule ^/([^/\.]+)/(.*) http://localhost:8080/$1/live/$2 [P]
>
>        ProxyPassReverse / http://localhost:8080/
>
>HTH anyone who tries a similar configuration. Please, try it if you
>can and tell me about.
>
>Rafa
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
>For additional commands, e-mail: user-help@lenya.apache.org
>
>
>  
>

-- 
---------------======ooOO000OOoo======---------------
Vicente Javier Rosselló Ferrer
E-mail: vrossello@uib.es
Tel: 971 17 2884
Centre de Tecnologies de la Informació a la UIB

Edifici Anselm Turmeda - CTI
Ctra. Valldemossa 7.5km
Universitat de les Illes Balears
============================================== 

Este mensaje, y toda la información adjunta, es confidencial y puede ser de uso restringido. 
Si Ud. no es uno de los destinatarios señalados, por favor informe al emisor, y borre y destruya el original y todas las copias del mensaje.  
No debe copiar, reenviar y / o revelar este mensaje , total o parcialmente, sin autorización del emisor.

This message, including attachments, is confidential and may be privileged. 
If you ar not an intended recipient, please notify the sender then delete and destroy the orginial message and all copies. 
You should not copy, forward and/or disclose this message, in whole or in part, without permission of the sender.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Problems with proxy

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Mon, 13 Jun 2005, Rafa Pérez wrote:

> On 6/2/05, Rafa Pérez <ra...@gmail.com> wrote:

[ ... ]
>
> Hi again. After some time trying some things with my proxy
> configuration here I am again.
> First of all, it seems that if are defined some rewriting rules in the
> apache configuration file, it is not necesary to change the
> publication.xconf at all. In fact, I have done this and it works, so I
> wonder why should it be necesary to change that file?

The proxy settings are also needed within lenya itself for LinkRewriting.
If you definge e.g.

<proxy url="http://www.yourpub.org" ssl="false" area="live"/>

You will end up wiht url's like http://www.yourpub.org/foo/bar.html. If
you did not define the live proxy you will have url's likd
http://www.yourpub.org:8080/lenya/pubid/live/foo/bar.html.

>
> Otherwise, I have deployed my publication in tomcat under the ROOT
> context of the servlet engine (as explained in
> http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya.html)
> and I realized about some problems when trying to make the proxying
> for the live side of the site:
>     * The pages shown in the first level of the publication (as the
> index page of the site) search for the css and the project-logo in
> "/lenya/{pub}/live/css/page.css"  and
> "/lenya/{pub}/live/images/project-logo.jpg".
>     * The pages shown in the second level look for the same files in
> "../css/page.css" and "../images/projecto-logo.jpg"
>

That would means that the context-prefix is hardcoded. Is this related to
http://issues.apache.org/bugzilla/show_bug.cgi?id=31157?

[ ... ]

Jann

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Problems with proxy

Posted by Rafa Pérez <ra...@gmail.com>.
On 6/2/05, Rafa Pérez <ra...@gmail.com> wrote:
> > I have no answer simple answer to your question. I propose the following
> > procedure:
> > - empty you rewrite-log
> > - access the index page one time and having a look at the page source in
> > order to get the path to your css
> > - ater that I would analyse your rewrite log especially what is happening
> > with the css-request.
> >
> > BTW it is important the your publication.xconf file is matched to your
> > RewriteRule.
> >
> My fault again. I had changed the url in my publication.xconf several
> times to make it work and I forgot to put the correct one in the last
> test. I changed it and everything is working fine. Thank you for all
> your help Jann.

Hi again. After some time trying some things with my proxy
configuration here I am again.
First of all, it seems that if are defined some rewriting rules in the
apache configuration file, it is not necesary to change the
publication.xconf at all. In fact, I have done this and it works, so I
wonder why should it be necesary to change that file?
Otherwise, I have deployed my publication in tomcat under the ROOT
context of the servlet engine (as explained in
http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya.html)
and I realized about some problems when trying to make the proxying
for the live side of the site:
    * The pages shown in the first level of the publication (as the
index page of the site) search for the css and the project-logo in
"/lenya/{pub}/live/css/page.css"  and 
"/lenya/{pub}/live/images/project-logo.jpg".
    * The pages shown in the second level look for the same files in
"../css/page.css" and "../images/projecto-logo.jpg"

This behaviour makes that the rewrite rules given in
http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya_continued.html
are not completely correct to make it work properly. E.g. if I am
trying to make apache serves the pages as http://www.client.com/mypub
(and I have deployed under the ROOT context in tomcat), I need to
change

                    # Rewrite for Lenya-wide resources (e.g. 404 page) 
                    RewriteRule ^/lenya/(.*)
http://www.client.com:8080/lenya/$1 [P]
to
                    RewriteRule ^/lenya/(.*) http://www.client.com:8080/$1 [P]

On the other hand, if I configure apache to serve the pages through
http://www.mypub.com, I need to change the rewrite rules to make them
appear in the following order:
        RewriteRule ^/$ index.html [R]
        RewriteRule ^/gruposfa/live/(.*)$ $1 [R,L]
        #This is one of the rules for the Lenya-wide resources. It must
        #be write as it appears in the tutorial
        RewriteRule ^/lenya/(.*) http://localhost:8080/lenya/$1 [P]

        RewriteRule ^/(.*) http://localhost:8080/gruposfa/live/$1 [P]        

        # Rewrite for Lenya-wide resources (e.g. 404 page)
        RewriteRule ^/([^/\.]+)/(.*) http://localhost:8080/$1/live/$2 [P]

        ProxyPassReverse / http://localhost:8080/

HTH anyone who tries a similar configuration. Please, try it if you
can and tell me about.

Rafa

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Problems with proxy

Posted by Rafa Pérez <ra...@gmail.com>.
> I have no answer simple answer to your question. I propose the following
> procedure:
> - empty you rewrite-log
> - access the index page one time and having a look at the page source in
> order to get the path to your css
> - ater that I would analyse your rewrite log especially what is happening
> with the css-request.
> 
> BTW it is important the your publication.xconf file is matched to your
> RewriteRule.
> 
My fault again. I had changed the url in my publication.xconf several
times to make it work and I forgot to put the correct one in the last
test. I changed it and everything is working fine. Thank you for all
your help Jann.

Rafa

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Problems with proxy

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Wed, 1 Jun 2005, Rafa Pérez wrote:


[ ... ]
>
> Hi again and thanks for your responses. I revised my configuration and
> there were some things that I was doing wrong. First of all, I had not
> loaded mod_rewrite in apache (I am pretty new to apache's
> configuration and did not take care of this), and, as Jann told, the
> RewriteRules and ProxyPass do not work fine together. I have followed
> again step by step the instructions given in
> http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya_continued.html
>   and have experienced a curious behaviour. When I try to acces the
> index of the publication, no format is given to the pages again. But
> if I go one level down, the page is shown with all the style and the
> images. I think it is a problem with the way the css and the images
> are seeked when they are called and redirected, but I can not find it.
> My rules are the following:
>
>                     RewriteRule ^/([^/\.]+)$ $1/ [R]
>                     RewriteRule ^/([^/\.]+)/$ $1/index.html [R]
>                     RewriteRule ^/([^/\.]+)/live/(.*)$ $1/$2 [R,L]
>
>                     # Rewrite for Lenya-wide resources (e.g. 404 page)
>                     RewriteRule ^/lenya/(.*)
> http://gruposfa.sfa1:8080/lenya/$1 [P]
>                     RewriteRule ^/([^/\.]+)/(.*)
> http://gruposfa.sfa1:8080/$1/live/$2 [P]
>                     ProxyPassReverse / http://gruposfa.sfa1:8080/
>
> I have deployed Lenya 1.2.3 under the ROOT context of tomcat 5.0.28.
> The rewrite log is attached. Any help is appreciated.
>

I have no answer simple answer to your question. I propose the following
procedure:
- empty you rewrite-log
- access the index page one time and having a look at the page source in
order to get the path to your css
- ater that I would analyse your rewrite log especially what is happening
with the css-request.

BTW it is important the your publication.xconf file is matched to your
RewriteRule.

Jann

---------------------------------------------------------------
Jann Forrer
Informatikdienste
Universität Zürich
Winterthurerstr. 190
CH-8057 Zuerich

oooO   mail:  jann.forrer@id.unizh.ch
(  )   phone: +41 44 63 56772
 \ (   fax:   +41 44 63 54505
  \_)  http://www.id.unizh.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Problems with proxy

Posted by Rafa Pérez <ra...@gmail.com>.
Sorry, I forgot to attach the file :D

Thaks!

Re: Problems with proxy

Posted by Rafa Pérez <ra...@gmail.com>.
> > Did you check your error log? The links to css and images, obviously,
> > aren't being rewritten correctly. What  does the error log say?
> >
> 
> You can have RewriteLog directives like:
> 
> RewriteLog       "/var/log/apache2/your-log"
> RewriteLogLevel 9
> 
> I am not quite sure whether RewriteRules and ProxyPass can work  together
> because ProxyPass / will pass all requests to your servlet engine
> and the RewriteRules will not be taken into account. Usually you have
> something liks
> 
> ......
> RewriteRule ^/lenya/(.*) http://localhost:8080/lenya/$1 [P]
> ProxyPassReverse / http://localhost:8080

Hi again and thanks for your responses. I revised my configuration and
there were some things that I was doing wrong. First of all, I had not
loaded mod_rewrite in apache (I am pretty new to apache's
configuration and did not take care of this), and, as Jann told, the
RewriteRules and ProxyPass do not work fine together. I have followed
again step by step the instructions given in
http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya_continued.html
  and have experienced a curious behaviour. When I try to acces the
index of the publication, no format is given to the pages again. But
if I go one level down, the page is shown with all the style and the
images. I think it is a problem with the way the css and the images
are seeked when they are called and redirected, but I can not find it.
My rules are the following:

                    RewriteRule ^/([^/\.]+)$ $1/ [R] 
                    RewriteRule ^/([^/\.]+)/$ $1/index.html [R] 
                    RewriteRule ^/([^/\.]+)/live/(.*)$ $1/$2 [R,L]

                    # Rewrite for Lenya-wide resources (e.g. 404 page) 
                    RewriteRule ^/lenya/(.*)
http://gruposfa.sfa1:8080/lenya/$1 [P]
                    RewriteRule ^/([^/\.]+)/(.*)
http://gruposfa.sfa1:8080/$1/live/$2 [P]
                    ProxyPassReverse / http://gruposfa.sfa1:8080/

I have deployed Lenya 1.2.3 under the ROOT context of tomcat 5.0.28.
The rewrite log is attached. Any help is appreciated.

Thanks in advance 

Rafa

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Problems with proxy

Posted by Jann Forrer <ja...@id.unizh.ch>.
On Tue, 24 May 2005, Sean Fulton wrote:

> On 2005-05-24 09:01:29 -0400, Rafa Pérez <ra...@gmail.com> said:
>
> > Hi all. I have been trying to proxy lenya with mod_proxy following the
> > instructions given in
> > http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya_continued.html
> > but I have not succeeded (only the live side of a publication).
> > The pages are served, but the have not any style, they are served only
> > as text and links, and images are not displayed too. I have the
> > following configuration in my apache's config file:
> >
> > <VirtualHost *:80>
> >
> >         ServerName   mypub.com
> >
> >         ProxyRequests Off
> >         RewriteEngine On
> >
> >         DirectoryIndex index.html
> >
> >         <Proxy *>
> >                 Order deny,allow
> >                 Allow from all
> >         </Proxy>
> >
> >         ProxyPass / http://localhost:8080/lenya/mypub/live/
> >         ProxyPassReverse / http://localhost:8080/lenya/mypub/live/
> >         # this is needed for css, etc.
> >         RewriteRule ^/$ index.html [R]
> >         RewriteRule ^/lenya/mypub/live/(.*)$ $1 [R,L]
> >         RewriteRule ^/lenya(.*) http://localhost:8080/lenya/mypub/live/$1 [ P]
> >
> >         # Rewrite for Lenya-wide resources (e.g. 404 page)
> >         RewriteRule ^/lenya/(.*) http://localhost:8080/lenya/$1 [P]
> >         RewriteRule ^/([^/\.]+)/(.*) http://localhost:8080/$1/live/$2 [P]
> >
> >         CustomLog /var/log/apache2/gruposfa-access.log combined
> >         ErrorLog /var/log/apache2/gruposfa-error.log
> >
> > </VirtualHost>
> >
> > I am using lenya-1.2.3 on tomcat-5.0.28, and I have deployed lenya in
> > ${TOMCAT_HOME}/webapps/lenya. Does anyone know what is wrong?
>
> Did you check your error log? The links to css and images, obviously,
> aren't being rewritten correctly. What  does the error log say?
>

You can have RewriteLog directives like:

RewriteLog       "/var/log/apache2/your-log"
RewriteLogLevel 9

I am not quite sure whether RewriteRules and ProxyPass can work  together
because ProxyPass / will pass all requests to your servlet engine
and the RewriteRules will not be taken into account. Usually you have
something liks

......
RewriteRule ^/lenya/(.*) http://localhost:8080/lenya/$1 [P]
ProxyPassReverse / http://localhost:8080

HTH

Jann

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Problems with proxy

Posted by Sean Fulton <fu...@cmu.edu>.
On 2005-05-24 09:01:29 -0400, Rafa Pérez <ra...@gmail.com> said:

> Hi all. I have been trying to proxy lenya with mod_proxy following the
> instructions given in
> http://lenya.apache.org/1_2_x/tutorial/mod_proxy_and_lenya_continued.html
> but I have not succeeded (only the live side of a publication).
> The pages are served, but the have not any style, they are served only
> as text and links, and images are not displayed too. I have the
> following configuration in my apache's config file:
> 
> <VirtualHost *:80>
> 
>         ServerName   mypub.com
> 
>         ProxyRequests Off
>         RewriteEngine On
> 
>         DirectoryIndex index.html
> 
>         <Proxy *>
>                 Order deny,allow
>                 Allow from all
>         </Proxy>
> 
>         ProxyPass / http://localhost:8080/lenya/mypub/live/
>         ProxyPassReverse / http://localhost:8080/lenya/mypub/live/
>         # this is needed for css, etc.
>         RewriteRule ^/$ index.html [R]
>         RewriteRule ^/lenya/mypub/live/(.*)$ $1 [R,L]
>         RewriteRule ^/lenya(.*) http://localhost:8080/lenya/mypub/live/$1 [ P]
> 
>         # Rewrite for Lenya-wide resources (e.g. 404 page)
>         RewriteRule ^/lenya/(.*) http://localhost:8080/lenya/$1 [P]
>         RewriteRule ^/([^/\.]+)/(.*) http://localhost:8080/$1/live/$2 [P]
> 
>         CustomLog /var/log/apache2/gruposfa-access.log combined
>         ErrorLog /var/log/apache2/gruposfa-error.log
> 
> </VirtualHost>
> 
> I am using lenya-1.2.3 on tomcat-5.0.28, and I have deployed lenya in
> ${TOMCAT_HOME}/webapps/lenya. Does anyone know what is wrong?

Did you check your error log? The links to css and images, obviously, 
aren't being rewritten correctly. What  does the error log say?

	Sean



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org