Proxy from Apache to local Lighttpd instance

Hello,

I’m having a serious problem proxying from Apache (2.2) to local
Lighttpd
servers. I need this to run Rails instances on www.mysite.com/rails next
to
the regular part from www.mysite.com.
Currently I get a working www.mysite.com/rails for only the first page,
controllers do not work. I am quite desperate in getting this to work as
it
is the only way I can run Rails at our systems…
My configuration is as follows:
my apache config has the following line at the bottom:
ProxyPass /cookbook http://localhost:3000/cookbook
ProxyPassReverse /cookbook http://localhost:3000/cookbook
my lighttpd config is essentially the same as at
http://wiki.rubyonrails.com/rails/pages/HowtoSetupApacheProxyingToLighttpdWithFastCGI.
below in my environment.rb it says:
ActionController::AbstractRequest.relative_url_root = ‘/cookbook’
Now surfing to www.mysite.com/cookbook works fine, altough I get the
security warning for the info.
If I generate a controller MyTest (ruby script/generate controller
MyTest)
and I restart the server I get:
Routing Error
Recognition failed for “/MyTest”
Why? My lighttpd access log says:
127.0.0.1 localhost:3000 - [04/Aug/2006:16:23:34
+0200] “GET /cookbook/MyTest HTTP/1.1” 404 607 “-” “Mozilla/5.0
(compatible; Konqueror/3.5; Linux) KHTML/3.5.2 (like Gecko)”

my development.log:
ActionController::RoutingError (Recognition failed for “/MyTest”):
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/routing.rb:521:in
recognition_failed' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/routing.rb:511:inrecognize!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/dispatcher.rb:38:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:150:inprocess_request’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:54:in
process!' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:600:ineach_cgi’
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in each_cgi' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:53:inprocess!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/fcgi_handler.rb:23:in
`process!’
/home/bbraem/cookbook/public/dispatch.fcgi:24

Rendering
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.3/lib/action_controller/templates/rescues/layout.rhtml
(404 Page Not Found)

my Lighttpd error log:
2006-08-04 16:23:34: (request.c.293) fd: 7 request-len: 521
GET /cookbook/MyTest HTTP/1.1
Host: localhost:3000
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.2
(like
Gecko)
Accept: text/html, image/jpeg, image/png, text/, image/, /
Accept-Encoding: x-gzip, x-deflate, gzip, deflate
Accept-Charset: iso-8859-1, utf-8;q=0.5, *;q=0.5
Accept-Language: en
Cookie: _session_id=771f1bb2977865b939344efae0430bcc
Max-Forwards: 10
X-Forwarded-For: 143.129.77.66
X-Forwarded-Host: mysite.com
X-Forwarded-Server: mysite.com

2006-08-04 16:23:34: (response.c.196) – splitting Request-URI
2006-08-04 16:23:34: (response.c.197) Request-URI : /cookbook/MyTest
2006-08-04 16:23:34: (response.c.198) URI-scheme : http
2006-08-04 16:23:34: (response.c.199) URI-authority: localhost:3000
2006-08-04 16:23:34: (response.c.200) URI-path : /cookbook/MyTest
2006-08-04 16:23:34: (response.c.201) URI-query :
2006-08-04 16:23:34: (response.c.251) – sanatising URI
2006-08-04 16:23:34: (response.c.252) URI-path : /cookbook/MyTest
2006-08-04 16:23:34: (response.c.360) – before doc_root
2006-08-04 16:23:34: (response.c.361)
Doc-Root : /home/bbraem/cookbook/public/
2006-08-04 16:23:34: (response.c.362) Rel-Path : /cookbook/MyTest
2006-08-04 16:23:34: (response.c.363) Path :
2006-08-04 16:23:34: (response.c.411) – after doc_root
2006-08-04 16:23:34: (response.c.412)
Doc-Root : /home/bbraem/cookbook/public/
2006-08-04 16:23:34: (response.c.413) Rel-Path : /cookbook/MyTest
2006-08-04 16:23:34: (response.c.414)
Path : /home/bbraem/cookbook/public/cookbook/MyTest
2006-08-04 16:23:34: (response.c.431) – logical -> physical
2006-08-04 16:23:34: (response.c.432)
Doc-Root : /home/bbraem/cookbook/public/
2006-08-04 16:23:34: (response.c.433) Rel-Path : /cookbook/MyTest
2006-08-04 16:23:34: (response.c.434)
Path : /home/bbraem/cookbook/public/MyTest
2006-08-04 16:23:34: (response.c.451) – handling physical path
2006-08-04 16:23:34: (response.c.452)
Path : /home/bbraem/cookbook/public/MyTest
2006-08-04 16:23:34: (response.c.492) – file not found
2006-08-04 16:23:34: (response.c.493)
Path : /home/bbraem/cookbook/public/MyTest
2006-08-04 16:23:34: (response.c.196) – splitting Request-URI
2006-08-04 16:23:34: (response.c.197) Request-URI : dispatch.fcgi
2006-08-04 16:23:34: (response.c.198) URI-scheme : http
2006-08-04 16:23:34: (response.c.199) URI-authority: localhost:3000
2006-08-04 16:23:34: (response.c.200) URI-path : dispatch.fcgi
2006-08-04 16:23:34: (response.c.201) URI-query :
2006-08-04 16:23:34: (response.c.251) – sanatising URI
2006-08-04 16:23:34: (response.c.252) URI-path : /dispatch.fcgi
2006-08-04 16:23:34: (response.c.360) – before doc_root
2006-08-04 16:23:34: (response.c.361)
Doc-Root : /home/bbraem/cookbook/public/
2006-08-04 16:23:34: (response.c.362) Rel-Path : /dispatch.fcgi
2006-08-04 16:23:34: (response.c.363) Path :
2006-08-04 16:23:34: (response.c.411) – after doc_root
2006-08-04 16:23:34: (response.c.412)
Doc-Root : /home/bbraem/cookbook/public/
2006-08-04 16:23:34: (response.c.413) Rel-Path : /dispatch.fcgi
2006-08-04 16:23:34: (response.c.414)
Path : /home/bbraem/cookbook/public/dispatch.fcgi
2006-08-04 16:23:34: (response.c.431) – logical -> physical
2006-08-04 16:23:34: (response.c.432)
Doc-Root : /home/bbraem/cookbook/public/
2006-08-04 16:23:34: (response.c.433) Rel-Path : /dispatch.fcgi
2006-08-04 16:23:34: (response.c.434)
Path : /home/bbraem/cookbook/public/dispatch.fcgi
2006-08-04 16:23:34: (response.c.451) – handling physical path
2006-08-04 16:23:34: (response.c.452)
Path : /home/bbraem/cookbook/public/dispatch.fcgi
2006-08-04 16:23:34: (response.c.459) – file found
2006-08-04 16:23:34: (response.c.460)
Path : /home/bbraem/cookbook/public/dispatch.fcgi
2006-08-04 16:23:34: (response.c.582) – handling subrequest
2006-08-04 16:23:34: (response.c.583)
Path : /home/bbraem/cookbook/public/dispatch.fcgi
2006-08-04 16:23:34: (mod_fastcgi.c.3549) handling it in mod_fastcgi
2006-08-04 16:23:34: (connections.c.1394) Warning: Either the
error-handler
returned status 404 or the error-handler itself was not found:
dispatch.fcgi
2006-08-04 16:23:34: (connections.c.1396) returning the original status
404
2006-08-04 16:23:34: (connections.c.1398) If this is a rails app: check
your
production.log
2006-08-04 16:23:34: (response.c.111) Response-Header:
HTTP/1.1 404 Not Found
Transfer-Encoding: chunked
Content-Type: text/html
Set-Cookie: _session_id=771f1bb2977865b939344efae0430bcc; path=/
Cache-Control: no-cache
Date: Fri, 04 Aug 2006 14:23:34 GMT
Server: lighttpd/1.4.11

app/controllers/my_test_controller.rb:
class MyTestController < ApplicationController
def index
render_text “Hello ze world”
end
end

What is going wrong here? Any help would be appreciated, if I can’t get
this
to work my project fails painfully…

Bart

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs