[yast-devel] Re: [yast-commit] <web-client> master : - Fixed static overlay when running in lighttpd server (bnc#544355)]
Ladislav Slezak schrieb:
On 7.10.2009 20:14, Ladislav Slezak wrote:
ref: refs/heads/master commit 23f769a1d9bd45762bf2eddbea731d1a64542dee Author: Ladislav Slezak
Date: Wed Oct 7 20:14:36 2009 +0200 [...]
diff --git a/webclient/lib/yast/rack/static_overlay.rb b/webclient/lib/yast/rack/static_overlay.rb index 807470d..0548cf7 100644 --- a/webclient/lib/yast/rack/static_overlay.rb +++ b/webclient/lib/yast/rack/static_overlay.rb @@ -25,11 +25,21 @@ module YaST def call(env) req = ::Rack::Request.new(env) resource = URI.parse(req.url).path - puts resource + + # this is a workaround for lighttpd server + # where all requests go through FastCGI dispatcher + if resource == '/dispatch.fcgi' + # get the real request path + resource = env['REQUEST_URI'] + # Rack expects the path in PATH_INFO which is not set by lighttpd + env['PATH_INFO'] = env['REQUEST_URI'] + end +
I'm not sure if this is the correct fix, I have found that the environment ('env' variable in the code above) is quite different when running in lighttpd server (in contrast to Mongrel or Webrick).
Thank you Ladislav for finding the reason for this bug. I can imaging that it has been quite "tricky" :-) I think that environment variable should be set in rails.include which is used by the lighttpd: # # usage: # $HTTP["host"] == "someapp.opensuse.org" { # rails_app = "someapp" # rails_root = "/srv/www/opensuse/someapp" # rails_procs = 4 # # production/development are typical values here # rails_mode = "production" # include "vhosts.d/rails.inc" # } # # quick fix for security bug in rails 1.1 # url.rewrite-once = ( "^/(app|components|config|db|doc|lib|log|public|script|test|tmp|vendor)/" => "/index.html" ) url.rewrite += ("^/apidocs(/|)$" => "/apidocs/html/index.html") magnet.attract-physical-path-to = ( conf_dir + "/cleanurl-v5.lua" ) accesslog.filename = log_root + "/obs-" + rails_app + "-access.log" rails_tmp = rails_root + "/tmp" server.document-root = rails_root + "/public" fastcgi.server = ( ".fcgi" => ( rails_app => ( "socket" => rails_tmp + "/sockets/fcgi.socket", "bin-path" => server.document-root + "/dispatch.fcgi", "bin-environment" => ( "RAILS_ENV" => rails_mode, "TMP" => rails_tmp ), "max-procs" => rails_procs, "idle-timeout" => 3600, ) ) )
Maybe the lighttpd config should be changed instead of this patch, I don't know. Can somebody check this possibility? Schubi? Duncan?
This is currently available for the service only. We will have to create this file for the client too. We need this file also for switching to production mode. The client still runs in development mode. So the fix is meanwhile absolutely OK. Thank you again for the fix ! Stefan
--
Best Regards
Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/
-- ******************************************************************************* Stefan Schubert SUSE LINUX GmbH - Maxfeldstrasse 5 - D-90409 Nuernberg, Germany e-mail: schubi@suse.de ------------------------------------------------------------------------------- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Thu, Oct 08, 2009 at 12:37:08PM +0200, Stefan Schubert wrote:
This is currently available for the service only. We will have to create this file for the client too. We need this file also for switching to production mode. The client still runs in development mode.
Actually not, Pepa has changed it to production already in this file, which is referenced by rcyastwc: http://git.opensuse.org/?p=projects/yast/web-client.git;a=commitdiff;h=c292c... But he says we do the lighttpd config inconsistently between the 2 packages and that should be fixed. (But please wait with that until I change the ports in the next hours...) -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
Martin Vidner
-
Stefan Schubert