Forum: Ruby on Rails Lighttpd - "Routing Error" in production?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7aef4541a1355c993c66237b162d9681?d=identicon&s=25 Henry GP (henryp)
on 2005-12-09 01:51
I'm running Lighttpd for an app behind an Apache proxy ... even though
I'm in production mode I get "Routing Error" for non-existent pages
instead of 404s.  Any ideas?  Thanks much in advance ...

httpd.conf:

<VirtualHost 10.0.0.50:80>
DocumentRoot "/data/wwwroot/railsapp.lan/public"
ServerName railsapp.lan
RewriteEngine On
ProxyPreserveHost On
RewriteRule ^/(.*) http://localhost:8010/$1 [P,L]
</VirtualHost>

lighttpd.conf:

server.username = "nobody"
server.groupname  = "nobody"
server.port = 8010
server.bind = "0.0.0.0"
server.pid-file = "/data/wwwroot/railsapp.lan/tmp/lighttpd.pid"
server.modules   = (     "mod_rewrite",
                                                                                        "mod_redirect",
                                                                                        "mod_access",
                                                                                        "mod_auth",
                                                                                        "mod_fastcgi",
                                                                                        "mod_accesslog"
)
server.document-root       = "/data/wwwroot/footballsquares.lan/public/"
server.indexfiles          = (  "dispatch.fcgi", "index.html" )
accesslog.filename              = "/www/logs/lighttpd_8010_access.log"
server.errorlog            = "/www/logs/lighttpd_8010_error.log"
server.error-handler-404        = "/dispatch.fcgi"

fastcgi.server = (
  ".fcgi" => (
    "localhost" => (
           "bin-environment" => ( "RAILS_ENV" => "production",
"LD_LIBRARY_PATH" => "/usr/local/lib" ),
      "socket" => "/data/wwwroot/railsapp.lan/tmp/lighttpd.socket",
      "bin-path" => "/data/wwwroot/railsapp.lan/public/dispatch.fcgi",
      "min-procs" => 1,
      "max_procs" => 5
    )
  )
)

mimetype.assign = (
  ".rpm"          =>      "application/x-rpm",
  ".pdf"          =>      "application/pdf",
#... etc
7aef4541a1355c993c66237b162d9681?d=identicon&s=25 Henry GP (henryp)
on 2005-12-14 01:03
Here's the fix: In the Apache vhost directive redirect to the local IP
address instead of localhost or 127.0.0.1.  Otherwise Rails thinks
you're local and spits out development environment-like 404s.

So instead of

RewriteRule ^/(.*) http://localhost:8010/$1 [P,L]

or

RewriteRule ^/(.*) http://127.0.0.1:8010/$1 [P,L]

Should be:

RewriteRule ^/(.*) http://10.0.0.50:8010/$1 [P,L]

Henry wrote:
> I'm running Lighttpd for an app behind an Apache proxy ... even though
> I'm in production mode I get "Routing Error" for non-existent pages
> instead of 404s.  Any ideas?  Thanks much in advance ...
This topic is locked and can not be replied to.