Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Provide a way to set https without hsts

Oliver Günthereec6e7fca3a7
diff --git a/lib/tasks/packager.rake b/lib/tasks/packager.rake
index bbb4587152a..facaccd26e2 100644
--- a/lib/tasks/packager.rake
+++ b/lib/tasks/packager.rake
@@ -68,9 +68,14 @@ namespace :packager do
Setting.sys_api_key = ENV['SYS_API_KEY']
Setting.host_name = ENV.fetch('SERVER_HOSTNAME', Setting.host_name)
- # Allow overriding the protocol setting from ENV
- # to allow instances where SSL is terminated earlier to respect that setting
- if ENV['SERVER_PROTOCOL_FORCE_HTTPS'] || ENV.fetch('SERVER_PROTOCOL', Setting.protocol) == 'https'
+ if ENV['SERVER_PROTOCOL_HTTPS_NO_HSTS']
+ # Allow setting only the Setting.protocol without enabling FORCE__SSL
+ # due to external proxy configuration
+ Setting.protocol = 'https'
+ shell_setup(['config:unset', "OPENPROJECT_RAILS__FORCE__SSL"])
+ elsif ENV['SERVER_PROTOCOL_FORCE_HTTPS'] || ENV.fetch('SERVER_PROTOCOL', Setting.protocol) == 'https'
+ # Allow overriding the protocol setting from ENV
+ # to allow instances where SSL is terminated earlier to respect that setting
Setting.protocol = 'https'
shell_setup(['config:set', "OPENPROJECT_RAILS__FORCE__SSL=true"])
else