LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > Embed inline Ruby & HTML?

Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2008, 05:33 PM
travisbell travisbell is offline
Senior Member
 
Join Date: Jan 2007
Location: Calgary, Canada
Posts: 51
Default Embed inline Ruby & HTML?

Hey guys,

I am currently using eruby + Apache to use embedded Ruby like so:

Code:
This text is <% a = 100; puts "#{a}% Live!" %>
This is NOT a Rails site, just HTML with inline Ruby. I found out about it while reading through the Pragmatic Programmers guide here, http://www.ruby-doc.org/docs/Program.../html/web.html

For now, I am using LiteSpeed to serve the Apache pages via the LiteSpeed Web API but it would be way better if I could process the Ruby natively through LiteSpeed.

Is there a way I can get this done?
__________________
Travis Bell
Meticulo
Reply With Quote
  #2  
Old 07-06-2008, 07:11 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
eRuby is CGI written in C, should be able to used together with LiteSpeed.
Reply With Quote
  #3  
Old 07-06-2008, 07:18 PM
travisbell travisbell is offline
Senior Member
 
Join Date: Jan 2007
Location: Calgary, Canada
Posts: 51
Quote:
Originally Posted by mistwang View Post
eRuby is CGI written in C, should be able to used together with LiteSpeed.
Yeah, I agree but couldn't get the MIME settings to work right in LS.

How can I go about adding the following MIME lines to LiteSpeed to make it work?

Code:
AddType application/x-httpd-eruby .rhtml
Action application/x-httpd-eruby /cgi-bin/eruby
Adding the AddType is easy but about about the Action?
__________________
Travis Bell
Meticulo
Reply With Quote
  #4  
Old 07-06-2008, 07:30 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
No need to use those configuration. try rewrite rule

RewriteRule (.*\.rhtml)$ /cgi-bin/eruby/$1

This should pass the rhtml file as PATH_TRANSLATED to eruby CGI. give it a try.
Reply With Quote
  #5  
Old 07-06-2008, 08:16 PM
travisbell travisbell is offline
Senior Member
 
Join Date: Jan 2007
Location: Calgary, Canada
Posts: 51
I disabled the Apache proxy and put that .htaccess in. Now LiteSpeed just wants to download the file instead of parsing it or throwing an error.

Should I still put a MIME type in to recognize the .rhtml?
__________________
Travis Bell
Meticulo
Reply With Quote
  #6  
Old 07-07-2008, 12:52 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
I tried the rewrite rule and it works.

Looks like your rewrite rule has not been configured properly. the request was not rewritten to /cgi-bin/eruby
Reply With Quote
  #7  
Old 07-19-2008, 09:05 PM
travisbell travisbell is offline
Senior Member
 
Join Date: Jan 2007
Location: Calgary, Canada
Posts: 51
My .htaccess looks like the following:

Code:
Options +Indexes

RewriteEngine On
RewriteRule (.*\.rhtml)$ /cgi-bin/eruby/$1
I have the .htaccess configured like so:


Click for full size - Uploaded with plasq's Skitch

Now what happens is I get a "500 Internal Server Error" with the following error in my logs:

Code:
[124.170.97.88:65109-6#iJabber] Maximum number of redirect reached.
Any ideas why this isn't working?
__________________
Travis Bell
Meticulo
Reply With Quote
  #8  
Old 07-19-2008, 09:32 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
You need to turn off rewrite in /cgi-bin/ directory. or test if the URL has been rewritten or not.
Reply With Quote
  #9  
Old 07-19-2008, 10:52 PM
travisbell travisbell is offline
Senior Member
 
Join Date: Jan 2007
Location: Calgary, Canada
Posts: 51
Got a little farther...

Disabled rewrite in /cgi-bin and now I get the following error in my logs:

Code:
[124.170.97.88:49646-0#iJabber] URI '/cgi-bin/eruby/register-gateway.rhtml' refers to a static file with PATH_INFO [/register-gateway.rhtml].
__________________
Travis Bell
Meticulo
Reply With Quote
  #10  
Old 07-20-2008, 06:57 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
You need to add a CGI context for "/cgi-bin/".
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:13 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.