Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes #1463 - let Foreman run on a sub path

e.g. for it being available on http://localhost:3000/foreman you run:

    RAILS_RELATIVE_URL_ROOT=/foreman rails s
  • Loading branch information...
commit b596ba5980d55ff14cb2d245e210c014756424b3 1 parent 26f75f4
@iNecas iNecas authored ohadlevy committed
View
6 config.ru
@@ -1,4 +1,8 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
-run Foreman::Application
+# apply a prefix to the application, if one is defined
+# e.g. http://some.server.com/prefix where '/prefix' is defined by env variable
+map ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do
+ run Foreman::Application
+end
View
6 lib/foreman/controller/environments.rb
@@ -8,7 +8,7 @@ def import_environments
rescue => e
if e.message =~ /puppet feature/i
error "We did not find a foreman proxy that can provide the information, ensure that you have at least one Proxy with the puppet feature turned on."
- redirect_to "/" + controller_path and return
+ redirect_to :controller => controller_path and return
else
raise e
end
@@ -18,7 +18,7 @@ def import_environments
render "common/_puppetclasses_or_envs_changed"
else
notice "No changes to your environments detected"
- redirect_to "/" + controller_path
+ redirect_to :controller => controller_path
end
end
@@ -28,7 +28,7 @@ def obsolete_and_new
else
error "Failed to update the environments and puppetclasses from the on-disk puppet installation<br/>" + errors.join("<br>")
end
- redirect_to "/" + controller_path
+ redirect_to :controller => controller_path
end
end
View
8 test/test_helper.rb
@@ -52,3 +52,11 @@ def disable_orchestration
ActiveSupport::TestCase.disable_orchestration
end
end
+
+class ActionController::TestCase
+ setup :setup_set_script_name
+
+ def setup_set_script_name
+ @request.env["SCRIPT_NAME"] = @controller.config.relative_url_root
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.