map subdirectory unless Passenger is used

This commit is contained in:
Markus Kahl
2014-05-30 10:33:57 +01:00
parent 714f15c56d
commit 3ff3135d34
+16 -3
View File
@@ -30,6 +30,19 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
use Rack::Protection::JsonCsrf
use Rack::Protection::FrameOptions
run OpenProject::Application
##
# Returns true if the application should be run under a subdirectory.
def map_subdir?
# Don't map subdir when using Passenger as passenger takes care of that.
!defined?(::PhusionPassenger)
end
subdir = map_subdir? && OpenProject::Configuration.rails_relative_url_root.presence
map (subdir || '/') do
use Rack::Protection::JsonCsrf
use Rack::Protection::FrameOptions
run OpenProject::Application
end