I think I solved my own problem, drawing from your help the other day.
I've now got the two folders as siblings below the root folder:
d:\db -- FoxPro databases, .prg code, etc.
d:\www -- The static web root. |
If I were starting from scratch, I would move the both of them below one container folder. As it is, I have to put fw_start.prg in the root folder. I don't like that, but I can't relocate the web root right now for other reasons.
I've now set the FoxWeb Program Root to d:\ .
I've tweaked fw_enter.prg to detect which folder to use. It assumes a full /cgi-bin/foxpro.exe/... URL, which currently make up 100% of our dynamic pages.
If the URL is not a CGI hit, fw_enter instead modifies Request.PathInfo to point to the static web root:
if (('.fwx' $ lower(cgi.logicalPath)) and empty(cgi.ExecutablePath)) Request.PathInfo = '/dl/' + CGI.LogicalPath ? 'redirecting to the web root: ' + Request.PathInfo return .T. endif
|
Initially, I tried this fw_enter redirect without changing the FoxWeb Program root. (it was d:/db/) That did not work. That is when I changed it to d:/ . I'm guessing that FoxWeb will not process a .fwx file outside it's Program Root. (Is that correct?) This is probably a good thing for security's sake.
A nice side effect is that my previous problem about the change in URL structure went away. (see: [Change in URL syntax form 1.x and 2.x ?]) I no longer have to redirect URLs to existing .prg files, as
PreviousWork@/db/pub/pub is now an accurate relative path from the FoxWeb Program Root.
Using this approach, it would be trivial to have several virtual program roots, keyed on whatever pattern in the URL is needed. (or based on session info, etc.)
Hope this may help someone someday.
----
BTW, I must express how refreshing it is to be able to programatically affect server settings like this. In nearly any other configuration issue, from applications to operating systems to web servers to hardware, you only have the options provided by the vendor. If those settings don't do what you need, you're simply out of luck more often than not.
Having fw_enter executed up front and giving it the ability to change the request in hand and make on-the-fly customizations is pure genius! I realize it may be just enough rope to hang myself, but it gets the job done today. How many times have you set a system paramter to "9", when you really mean "9...unless there are over 10 widgets in the queue, then use 99".
My hat is off to FoxWeb on this one! :-)
-dave
--
David Hempy
Internet Database Administrator
Kentucky Educational Television
(859)258-7164 - (800)333-9764
Sent by David Hempy on 04/05/2004 10:49:13 PM:
Is there any way to have two program roots? Or some other solution that will yield similar results?