Mapping file-not-found to a .rb file?

M

Marc Heiler

I am using latest Apache on Linux. I would like to have something like
this:


localhost/query
localhost/query/foobar

All these should be mapped to a specific .rb file but I wonder which
limitation this would have (I'd want to have as few restrictions as
possible), and how to make this even possible at all. Would this require
mod_rewrite or are there simpler alternatives? Preferrable I would not
want to run a daemon .rb file.
 
J

Joshua Ballanco

Marc said:
Would this require
mod_rewrite or are there simpler alternatives? Preferrable I would not
want to run a daemon .rb file.

You could just make a Ruby cgi script. Then, yes, some mod_rewrite
trickery should get you the desired results.

However, you might want to reconsider running a daemon .rb file. The
main reason that Rails/Rack/etc. go this route is that starting a Ruby
process is often the most intensive part of running a Ruby script
(doubly-so in the case of JRuby). Having a Ruby process idling and
waiting for requests is often more efficient.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top