Hello,

thank you for your quick reply ! It is great that you invest so much
time.

I cleaned up my configuration last night and started "fresh" with
web2py Version 1.61.4.
My problem with broken URLs behind my proxy is still there, but I
think
I went the wrong way by trying to fix it by using
mod_proxy_html (http://apache.webthing.com/mod_proxy_html/).

It should (and mostly does) work by "routes.py".

My Config:
Apache on Linux as a Proxy. It routes requests
"https:/<server>:443/web2py/<appl>/.." to "http:/localhost:8000/
<appl>/..":
--------
<VirtualHost _default_:443>
....
<Location /web2py/>
  ProxyPass http://localhost:8000/
  ProxyPassReverse /
</Location>
....
</VirtualHost>
--------

On port 8000 I have the Standalone-CherryPy-Server with the
"routes.py":
--------
#!/usr/bin/python
# -*- coding: utf-8 -*-
routes_in = ()
routes_out = ( ('/(?P<file>[\w\./_-]+)', '/web2py/\g<file>'), )
--------
This makes every URL in the web-pages start with "/web2py/..", so if
I
click a link in an application, it correctly finds it's way to
CherryPy via Apache.

And here's the (remaining) problem:

Some Pages are somehow "pre-generated" and therefore do not know about
the
changed "routes.py".
Best I could do is change the "routes.py" immediately after unpacking
the
installation zip, before the "first-time-start" where the applications
are generated.

Page "Hello World" still contains a Link "/admin/" where "/web2py/
admin/" should be,
In the Page "Installed Aplications": Link "Examples" points to "/
examples/default/index", but
"Design" points to "/web2py/admin/default/design/examples" (this is
correct behavior)
The Green Menu on Top of the Page is generally not correct: for
example
"Logout" points to "/admin/default/logout" instead of "/web2py/admin/
default/logout"

So the Question:

How do I regenerate all the affected Files (js, css, html, whatever)
after changes in "routes.py" ?
It does not need to be automatic, because routes.py is seldom changed.
If there is a simple way, then it would be nice to add it as a comment
in "routes.py":

After you change this file, issue the command "....." to update the
relevant pages.

Thank you for this great product, Bernd


On 22 Apr., 18:09, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I am not sure I understand so I apologize if the answer is incomplete.
>
> I do not know what mdp_proxy_html does vs mod_proxy.
>
> mod_proxy is required if you want to have another database server run
> as a proxy, but its job is not to rewrite URL, although you can do
> that.
>
> You can also have web2py rewrite URL using routes.py (an example in
> routes.example.py).
>
> routes supports both url mapping (routes_in) and reverse url mapping
> (routes_out) and if they match there is no problem. routes.py does not
> parse the generated for urls. So you should not do this:
>
>   jQuery(document).ready(function(){ setTimeout("keepalive('/yourapp/
> default/action')",10000); });
>
> You should do this instead
>
>   jQuery(document).ready(function(){ setTimeout("keepalive('{{=URL
> ('yourapp','default','action')}})'",10000); });
>
> Anyway I have a feeling you know about this more than I do. If you can
> propose any impeovement to the current mechanism, please let us know.
>
> Massimo
>
> On Apr 22, 5:41 am, Bernd das Brot <b.b...@gmx.at> wrote:
>
>
>
> > Hi web2py fans !
>
> > I want to use web2py (current production version 1.61.1) behind an
> > apache proxy, alongside other applications.
> > Therefore I need a unique URL-Prefix to guide mod_proxy to the
> > (standalone) web2py-Server
> > (Application "cookbook":https://server:port/prefix/cookbook/...)
>
> > 1) I followed the instructions in the FAQs using "mod_proxy_html" and
> > it kind-of-works:
> >     it rewrites URLs like "<a href="/cookbook/..>" to <a href="/prefix/
> > cookbook/">" BUT
> >     in Javascript it does not understand things like
>
> >     jQuery(document).ready(function(){ setTimeout("keepalive('/admin/
> > default/keepalive')",10000); });
>
> >    and therefore does not rewrite it. Result: no editor-Keepalive, but
> > (after 10 seconds) an red text
> >    "Communication Error".
>
> >   How can I fix this in mod_proxy_html (No, I do not want to hardcode
> > it into the framework) ?
>
> > 2) Can somebody with deeper knowledge of web2py explain, why I need
> > mod_proxy_html anyway ?
>
> >     IMHO the use of mod_proxy_html is a workaround for something a
> > decent framework should do.
> >     "route.py" does "half" of it but "breaks your application" (!):
> >     The "URL()" function does not use the variables from "route.py",
> > so the absolute URLs
> >     (in page code and in javascript) are not proxy-aware (but could be
> > - I don't think that this is
> >     too hard).
>
> >     Thanks for any replies, Bernd- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to