Graham Dumpleton
graham.dumpleton at gmail.com
Wed Apr 11 19:38:54 EDT 2007
What if you use wget/curl to get the page? At least with those programs it should only make one request. There must be something in the page that causes the browser to re-request it. If mod_rewrite becomes a pain, the only other way would be to write using mod_python your own transhandler (I think this is best) which matches req.uri for what you want and then sets req.filename and req.args to what you need. Also possibly may want to even set req.handler at that point to 'mod_python' and even register the handler to call using req.add_handler(). That way the only thing in Apache configuration is PythonTransHandler and PythonOption directives. This will possibly give you better control than mod_rewrite but does mean that all requests go through Python handler code which may be a performance issue. Other than that suggestion, would need to experiment but don't have time right now. Graham On 12/04/07, Nathan C. Tresch <nathan at yapta.com> wrote: > When I load JUST the page I don't get the reloading problem, only when I use > the rewrite engine and [PT]. > > Using liveHeaders for Firefox I end up with a zillion(sic) 200 status's, > they never seem to stop. > > > On 4/11/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote: > > On 12/04/07, Nathan C. Tresch <nathan at yapta.com> wrote: > > > When I use [PT] both Firefox and IE continually reload the page and peg > the > > > CPU at 100%, however, I get the content I'm after. > > > > If you see the content you want but the browser is reloading, that > > would suggest an issue with the page. Does the HTML for the page have > > some meta data which forces a reload after some period. Can you use > > some low level mechanism to get the page (curl, wget, telnet) and see > > what the actual HTTP status code is and confirm it is just a 200 and > > not some sort of redirection status. Also look to see if a Location > > header is being returned which may be a target of a redirect. > > > > Graham > > > > > The other two options alter the debug output slightly, but still give > the > > > same result. The extra output just seems to specify it's setting the > > > MIME-type to mod_python > > > > > > > > > > > > On 4/11/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote: > > > > Does it make any difference if you use: > > > > > > > > RewriteRule /trip-([0-9]*)/.*/ > > > /user/trip.myt\?tab=airlines&id=$1 [PT] > > > > > > > > or: > > > > > > > > RewriteRule /trip-([0-9]*)/.*/ > > > /user/trip.myt\?tab=airlines&id=$1 > > > > [H=mod_python] > > > > > > > > Can't remember if latter requires Apache 2.2 If older version of > > > > Apache maybe try: > > > > > > > > RewriteRule /trip-([0-9]*)/.*/ > > > /user/trip.myt\?tab=airlines&id=$1 > > > > [T=mod_python] > > > > > > > > Graham > > > > > > > > On 12/04/07, Nathan C. Tresch < nathan at yapta.com> wrote: > > > > > Yes, /user/trip.myt?tab=airline&id=18335 works. > > > > > > > > > > AddHandler mod_python .py > > > > > AddHandler mod_python .myt > > > > > PythonHandler myghty.ApacheHandler::handle > > > > > PythonPath > > > > > "[r'/usr/local/data/wwwdev/ntresch']+sys.path" > > > > > PythonOption MyghtyInterpreterName r"ntresch_interp" > > > > > PythonOption MyghtyComponentRoot \ > > > > > "[ \ > > > > > > {'components':'/data/wwwdev/ntresch/public'}, \ > > > > > > > > > > > {'templates':'/data/wwwdev/ntresch/myghty/templates'} \ > > > > > ]" > > > > > PythonOption MyghtyDataDir > > > > > r"/data/wwwdev/ntresch/myghty/data" > > > > > > > > > > > > > > > #PythonHandler mod_python.publisher > > > > > PythonDebug On > > > > > > > > > > These lines are located in the main apache config file. > > > > > > > > > > > > > > > On 4/11/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote: > > > > > > Does using: > > > > > > > > > > > > /user/trip.myt?tab=airline&id=18335 > > > > > > > > > > > > in the browser work? > > > > > > > > > > > > What is the Apache configuration snippet you are using to enable > > > > > > mod_python for this URL? Where is it located, main Apache > > > > > > configuration or .htaccess file? > > > > > > > > > > > > Graham > > > > > > > > > > > > On 12/04/07, Nathan C. Tresch < nathan at yapta.com> wrote: > > > > > > > So, here is what I get: > > > > > > > > > > > > > > %tail -f rewrite_log > > > > > > > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [ > > > > > > > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial > ] > > > (2) > > > > > init > > > > > > > rewrite engine with requested uri /trip-18335/Minneapolis/St. > > > > > > > Paul/Washington/ > > > > > > > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [ > > > > > > > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial] > (3) > > > > > > > applying pattern '/trip-([0-9]*)/.*/' to uri > > > > > '/trip-18335/Minneapolis/St. > > > > > > > Paul/Washington/' > > > > > > > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [ > > > > > > > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial] > (2) > > > > > rewrite > > > > > > > '/trip-18335/Minneapolis/St. Paul/Washington/' -> > > > > > > > '/user/trip.myt?tab=airline&id=18335' > > > > > > > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [ > > > > > > > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial > ] > > > (3) > > > > > split > > > > > > > uri=/user/trip.myt?tab=airline&id=18335 -> > > > > > > > uri=/user/trip.myt, args=tab=airline&id=18335 > > > > > > > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [ > > > > > > > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial > ] (2) > > > > > local > > > > > > > path result: /user/trip.myt > > > > > > > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [ > > > > > > > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial > ] > > > (2) > > > > > > > prefixed with document_root to > > > > > > > > /usr/local/data/wwwdev/ntresch/public/user/trip.myt > > > > > > > 67.42.99.238 - - [11/Apr/2007:15:44:23 --0700] [ > > > > > > > dev.yapta.com/sid#80d05f0][rid#8d3c050/initial > ] > > > (1) > > > > > > > go-ahead with > > > > > > > > /usr/local/data/wwwdev/ntresch/public/user/trip.myt > > > > > [OK] > > > > > > > > > > > > > > Yet my browser still gives me a 404. > > > > > > > > > > > > > > I suspect it's because python/myghty is looking for something in > the > > > > > > > origional path, it's modules maybe? And it can't find anything > > > there. > > > > > > > > > > > > > > > > > > > > > On 4/11/07, Graham Dumpleton <graham.dumpleton at gmail.com> > wrote: > > > > > > > > On 12/04/07, Nathan C. Tresch < nathan at yapta.com> wrote: > > > > > > > > > We're using Myghty and Mod_Python. The following > RewriteRule > > > > > produces a > > > > > > > > > 404: > > > > > > > > > > > > > > > > > > RewriteRule /trip-([0-9]*)/.*/ > > > > > > > > > /user/trip.myt\?tab=airlines&id=$1 [L] > > > > > > > > > > > > > > > > > > Previously, before we converted to PHP, the rule looked like > > > this: > > > > > > > > > > > > > > > > > > RewriteRule /trip-([0-9]*)/.*/ > > > > > > > > > /user/trip.php\?tab=airlines&id=$1 [L] > > > > > > > > > > > > > > > > > > This worked. > > > > > > > > > > > > > > > > > > Can anyone tell me what gives? > > > > > > > > > > > > > > > > Have you tried debugging what mod_rewrite is doing by > increasing > > > its > > > > > > > > logging output using the RewriteLogLevel directive etc? From > that > > > you > > > > > > > > can see what it finally rewrites it to. You can then try > putting > > > that > > > > > > > > URL into the browser directly and try and work out why any > other > > > > > > > > configuration may not be correct. > > > > > > > > > > > > > > > > Graham > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > Nathan C. Tresch > > > > > > > Software Engineer > > > > > > > YapTA! Inc. > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > Nathan C. Tresch > > > > > Software Engineer > > > > > YapTA! Inc. > > > > > > > > > > > > > > > > -- > > > > > > Nathan C. Tresch > > > Software Engineer > > > YapTA! Inc. > > > > > > -- > > Nathan C. Tresch > Software Engineer > YapTA! Inc.
|