Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Programming languages > apache mod_proxy plt web-server
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 24th October 13:01
jake
External User
 
Posts: 1
Default apache mod_proxy plt web-server


Hi all. I'm trying to figure out the most practical approach to using
scheme on the web (other than cgi).

So I'm looking at the PLT web server. Looks sweet. Trouble is that my
vps web host only runs apache, and I also don't want to be in charge of
keeping the web server running.

So I thought of using either mod_rewrite or mod_proxy to redirect all
requests with some uri (/scheme or something) to the plt webserver for
all non-static requests. It's a similar approach to using mod_lisp +
mzscheme, except that with plt I can use the continuations-based
paradigm, which looks mighty attractive for certain situations. I also
could use apache's authentication method that uses a sql table for the
users/passwords - plt only offers basic authentication.

Has anyone else tried the apache + plt combo, or anything like it?
Does anyone have thoughts as to whether this is overkill? Is there a
better solution?

Thanks for any thoughts.

- Jake
  Reply With Quote


  sponsored links


2 24th October 13:01
anton van straaten
External User
 
Posts: 1
Default apache mod_proxy plt web-server


Both mod_rewrite and mod_proxy work well for this, although I haven't
done anything with authentication.

For an example of using mod_rewrite, see:

http://list.cs.brown.edu/pipermail/plt-scheme/2004-August/006471.html

The rewrite rule given in that post is very general. I've used a more
specific one, e.g. the following should implement a /scheme uri:

Rewri****gine On
RewriteCond %{REQUEST_URI} ^/scheme/.*
RewriteRule ^/scheme/(.*)$ http://localhost:8080/servlets/$1 [P]

(Note this was adapted from a real rule and not tested, so I can't swear
it doesn't need to be tweaked.)

With mod_proxy, what I've done is map a host name to the PLT server,
using something like the following, which maps scheme.foo.org to a PLT
server on http://www.foo.org port 8080:

# use your IP address below, of course
<VirtualHost 192.168.0.111:80>
ServerName scheme.foo.org ProxyPass / http://www.foo.org:8080/
</VirtualHost>

Variations on this are possible.

Afaik, this approach can't be used in an .htaccess file, it has to
appear in the main Apache conf file or one of the files it includes --
e.g. in a shared hosting environment where you have a conf file for your
own site, the above can go in that file.

Anton
  Reply With Quote
3 24th October 13:11
jake
External User
 
Posts: 1
Default apache mod_proxy plt web-server


Anton: thanks very much for the information. My thought now is whether
such an approach, using plt only for /scheme uri's, apache for all
static stuff, will cause problems with the continuations stack.

Anyone have thoughts along this line?
  Reply With Quote
4 24th October 13:12
anton van straaten
External User
 
Posts: 1
Default apache mod_proxy plt web-server


Continuations work fine. There shouldn't be any interference with
static content served by Apache.

To demonstrate working continuations, here are two of PLT's sample
continuation-based servlets running behind Apache:

http://plt.appsolutions.com/servlets/examples/add.ss
http://plt.appsolutions.com/servlets/examples/quiz.ss

(I don't promise to leave these up indefinitely.) This is using the
virtual host approach, but the rewriting approach works as well.

Note that to a casual inspection (e.g. looking at response header info
for a valid request), the Apache proxying makes this appear to be a PLT
server. You'd have to access it by IP address to see an Apache response.

Now if you'll excuse me, inspired by the quiz, I'm going to brew an oil
barrel of tea.

Anton
  Reply With Quote
5 24th October 13:12
jake
External User
 
Posts: 1
Default apache mod_proxy plt web-server


Thank you for setting that up. The last page didn't display though -
something amiss? It said it couldn't be found on the server.

Do you have any experience using mod_fastcgi with scheme? I like the
idea of using the module's program manager, which would manage keeping
the scheme interpreter running for me, rather than making it a separate
process I have to manager (my web host will keep apache running for me,
but I doubt they'd keep plt running on the side).

I'm unclear as to how one would use mod_fastcgi with mzscheme. Have
you (or anyone else reading) tried this?
  Reply With Quote
6 24th October 13:12
anton van straaten
External User
 
Posts: 1
Default apache mod_proxy plt web-server


I hadn't noticed - you mean when the New Quiz button is pressed on the
last page of the quiz. That seems to be a bug in the PLT example - I've
just checked, and that happens even when connecting to the PLT web
server directly (not through Apache).


I haven't used FastCGI myself, but others have. See:
https://www.metnet.navy.mil/~latendre/metcast.html

BTW, this and some other options are mentioned here:
http://community.schemewiki.org/?scheme-faq-programming#H-6s1wpu

Anton
  Reply With Quote
7 24th October 13:13
anton van straaten
External User
 
Posts: 1
Default apache mod_proxy plt web-server


Further investigation indicates that this is due to the session timing
out - the default-servlet-timeout in the configuration table is set to
60 seconds. For a real system, you probably want to set it higher.

Anton
  Reply With Quote
8 24th October 13:13
jake
External User
 
Posts: 1
Default apache mod_proxy plt web-server


Thanks.

I decided against the mod_proxy route; n real reason, just feels less
comfortable.

I was able to get the mod_rewrite solution working with the following
rewrite condition and rule (had to tweak your example a bit, and I
wasn't able to use 'scheme' as the uri prefix):

# redirect plt servlet requests to plt web-server process on port
3000
RewriteCond %{REQUEST_URI} ^/servlets/.*$
RewriteRule ^/servlets/(.*)$ http://localhost:3000/servlets/$1 [P]

I then started apache, started plt on port 3000 ('web-server -p 3000 &'
for anyone curious), and was able to access the add.ss servlet as:

http://localhost/servlets/examples/add.ss

The problem when I used scheme/ as the uri prefix was that it loaded
the first page fine, but then when I pressed Enter it looked for
/servlets/examples/add.ss?id=....

So changing the uri prefix to /servlets fixed everything, because when
plt created the second page of add.ss, its
'/servlets/examples/add.ss?id=...' translated correctly via the
redirect.

So it seems plt doesn't expect to be run this way, but if this is the
only issue it's not a big one - you just have to use /servlets as the
redirected uri prefix.
  Reply With Quote
9 28th October 02:33
jamesshipley
External User
 
Posts: 1
Default apache mod_proxy plt web-server


For what it's worth, you can run a webapp on SISC in Tomcat and use


fashion. SISCWeb (http://siscweb.sourceforge.net/overview.html) goes
further in that it is a 'framework to facilitate writing stateful
Scheme web applications in a J2EE environment'. jake wrote:
  Reply With Quote
10 28th October 02:47
jake
External User
 
Posts: 1
Default apache mod_proxy plt web-server


Thanks for the SISC tip, but I prefer non-Java solutions for its
broader applicability and cheaper web hosting. You pay a lot for
Java, and for no real benefit in my opinion (unless the client's paying
for Java for whatever reason).
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666