diff --git a/ood-portal-generator/lib/ood_portal_generator/view.rb b/ood-portal-generator/lib/ood_portal_generator/view.rb
index 6a6835e054..783e050c8f 100644
--- a/ood-portal-generator/lib/ood_portal_generator/view.rb
+++ b/ood-portal-generator/lib/ood_portal_generator/view.rb
@@ -47,8 +47,8 @@ def initialize(opts = {})
@pun_stage_cmd = opts.fetch(:pun_stage_cmd, "sudo /opt/ood/nginx_stage/sbin/nginx_stage")
# custom directives
- @custom_vhost_directives = opts.fetch(:custom_vhost_directives, nil)
- @custom_location_directives = opts.fetch(:custom_location_directives, nil)
+ @custom_vhost_directives = opts.fetch(:custom_vhost_directives, [])
+ @custom_location_directives = opts.fetch(:custom_location_directives, [])
# Maintenance configuration
@use_maintenance = opts.fetch(:use_maintenance, true)
diff --git a/ood-portal-generator/share/ood_portal_example.yml b/ood-portal-generator/share/ood_portal_example.yml
index 01d550aae0..da322d808c 100644
--- a/ood-portal-generator/share/ood_portal_example.yml
+++ b/ood-portal-generator/share/ood_portal_example.yml
@@ -155,21 +155,21 @@
# - 'AuthType openid-connect'
# - 'Require valid-user'
-# Custom apache directives to apply to the entire vhost.
-# Note this is a multiline string.
+# List of custom apache directives to apply to the entire vhost.
+# Note this is an array of strings.
# Example:
-# custom_vhost_directives: |
-# SetEnv SPECIAL_ENV_VAR custom
-# Default: nil (no custom directives)
-#custom_vhost_directives: nil
+# custom_vhost_directives:
+# - 'SetEnv SPECIAL_ENV_VAR custom'
+# Default: [] (no custom directives)
+#custom_vhost_directives: []
-# Custom apache directives to apply to the Locations.
-# Note this is a multiline string.
+# List of custom apache directives to apply to the Locations.
+# Note this is an array of strings.
# Example:
-# custom_location_directives: |
-# SetEnv SPECIAL_ENV_VAR custom
-# Default: nil (no custom directives)
-#custom_location_directives: nil
+# custom_location_directives:
+# - 'SetEnv SPECIAL_ENV_VAR custom'
+# Default: [] (no custom directives)
+#custom_location_directives: []
# Redirect user to the following URI when accessing root URI
# Example:
diff --git a/ood-portal-generator/spec/fixtures/input/custom_directives.yml b/ood-portal-generator/spec/fixtures/input/custom_directives.yml
index b994746222..ef1da8a6b1 100644
--- a/ood-portal-generator/spec/fixtures/input/custom_directives.yml
+++ b/ood-portal-generator/spec/fixtures/input/custom_directives.yml
@@ -3,13 +3,16 @@ auth:
- 'AuthType openid-connect'
- 'Require valid-user'
-custom_location_directives: |
- SetEnv SPECIAL_LOCATION_ENV_VAR custom_location
- SetEnv SECOND_LOCATION_VAR custom_location2
- SetEnv INDENTED_LOCATION_VAR custom_location3
+custom_location_directives:
+ - 'SetEnv SPECIAL_LOCATION_ENV_VAR custom_location'
+ - 'SetEnv SECOND_LOCATION_VAR custom_location2'
+ - ' SetEnv INDENTED_LOCATION_VAR custom_location3'
-custom_vhost_directives: |
- SetEnv SPECIAL_VHOST_ENV_VAR custom_vhost
- SetEnv SECOND_VHOST_VAR custom_vhost2
- SetEnv INDENTED_VHOST_VAR custom_vhost3
+custom_vhost_directives:
+ - SetEnv SPECIAL_VHOST_ENV_VAR custom_vhost
+ - SetEnv SECOND_VHOST_VAR custom_vhost2
+ - ' SetEnv INDENTED_VHOST_VAR custom_vhost3'
+ - ''
+ - ' SetEnv SPECIAL_VHOST_LOCATION_ENV_VAR custom_vhost4'
+ - ''
diff --git a/ood-portal-generator/spec/fixtures/input/custom_location_directives.yml b/ood-portal-generator/spec/fixtures/input/custom_location_directives.yml
index 748d54f225..9cf5bb699d 100644
--- a/ood-portal-generator/spec/fixtures/input/custom_location_directives.yml
+++ b/ood-portal-generator/spec/fixtures/input/custom_location_directives.yml
@@ -3,6 +3,6 @@ auth:
- 'AuthType openid-connect'
- 'Require valid-user'
-custom_location_directives: |
- SetEnv SPECIAL_LOCATION_ENV_VAR custom_location
- SetEnv SECOND_LOCATION_VAR custom_location2
+custom_location_directives:
+ - SetEnv SPECIAL_LOCATION_ENV_VAR custom_location
+ - SetEnv SECOND_LOCATION_VAR custom_location2
diff --git a/ood-portal-generator/spec/fixtures/input/custom_vhost_directives.yml b/ood-portal-generator/spec/fixtures/input/custom_vhost_directives.yml
index a5911a46f7..3c6fc7b6c7 100644
--- a/ood-portal-generator/spec/fixtures/input/custom_vhost_directives.yml
+++ b/ood-portal-generator/spec/fixtures/input/custom_vhost_directives.yml
@@ -3,7 +3,7 @@ auth:
- 'AuthType openid-connect'
- 'Require valid-user'
-custom_vhost_directives: |
- SetEnv SPECIAL_VHOST_ENV_VAR custom_vhost
- SetEnv SECOND_VHOST_VAR custom_vhost2
+custom_vhost_directives:
+ - SetEnv SPECIAL_VHOST_ENV_VAR custom_vhost
+ - SetEnv SECOND_VHOST_VAR custom_vhost2
\ No newline at end of file
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.conf.all b/ood-portal-generator/spec/fixtures/ood-portal.conf.all
index 6634a60744..62a73cfe4e 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.conf.all
+++ b/ood-portal-generator/spec/fixtures/ood-portal.conf.all
@@ -115,6 +115,7 @@ Listen 8080
SetEnv OOD_ALLOWED_HOSTS "foo.example.com,test.proxy.name,test.server.name"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.conf.dex b/ood-portal-generator/spec/fixtures/ood-portal.conf.dex
index b3778c4450..26ea808db7 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.conf.dex
+++ b/ood-portal-generator/spec/fixtures/ood-portal.conf.dex
@@ -98,6 +98,7 @@
SetEnv OOD_ALLOWED_HOSTS "8.8.8.8,example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-full b/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-full
index 5ee7e799e3..a07936eb37 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-full
+++ b/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-full
@@ -118,6 +118,7 @@
SetEnv OOD_ALLOWED_HOSTS "example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-ldap b/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-ldap
index 6a5d29de3f..e9e434785a 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-ldap
+++ b/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-ldap
@@ -118,6 +118,7 @@
SetEnv OOD_ALLOWED_HOSTS "example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-no-proxy b/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-no-proxy
index bec6d6ac64..1c0092b7fc 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-no-proxy
+++ b/ood-portal-generator/spec/fixtures/ood-portal.conf.dex-no-proxy
@@ -112,6 +112,7 @@
SetEnv OOD_ALLOWED_HOSTS "example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.conf.maint_with_ips b/ood-portal-generator/spec/fixtures/ood-portal.conf.maint_with_ips
index fc760a3003..8737380adb 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.conf.maint_with_ips
+++ b/ood-portal-generator/spec/fixtures/ood-portal.conf.maint_with_ips
@@ -80,6 +80,7 @@
SetEnv OOD_ALLOWED_HOSTS "8.8.8.8,example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.conf.nomaint b/ood-portal-generator/spec/fixtures/ood-portal.conf.nomaint
index d9d570af4c..30613cbb4e 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.conf.nomaint
+++ b/ood-portal-generator/spec/fixtures/ood-portal.conf.nomaint
@@ -71,6 +71,7 @@
SetEnv OOD_ALLOWED_HOSTS "8.8.8.8,example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.conf.oidc b/ood-portal-generator/spec/fixtures/ood-portal.conf.oidc
index fed2152b8d..f1e8395d72 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.conf.oidc
+++ b/ood-portal-generator/spec/fixtures/ood-portal.conf.oidc
@@ -100,6 +100,7 @@
SetEnv OOD_ALLOWED_HOSTS "ondemand.example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.conf.oidc-ssl b/ood-portal-generator/spec/fixtures/ood-portal.conf.oidc-ssl
index dd7658faa8..132624f846 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.conf.oidc-ssl
+++ b/ood-portal-generator/spec/fixtures/ood-portal.conf.oidc-ssl
@@ -116,6 +116,7 @@
SetEnv OOD_ALLOWED_HOSTS "ondemand.example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/ood-portal.dex-full.proxy.conf b/ood-portal-generator/spec/fixtures/ood-portal.dex-full.proxy.conf
index 43d1ea102d..cd3c79a99d 100644
--- a/ood-portal-generator/spec/fixtures/ood-portal.dex-full.proxy.conf
+++ b/ood-portal-generator/spec/fixtures/ood-portal.dex-full.proxy.conf
@@ -118,6 +118,7 @@
SetEnv OOD_ALLOWED_HOSTS "example-proxy.com,example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/output/auth.conf b/ood-portal-generator/spec/fixtures/output/auth.conf
index 2576c3c972..201c552591 100644
--- a/ood-portal-generator/spec/fixtures/output/auth.conf
+++ b/ood-portal-generator/spec/fixtures/output/auth.conf
@@ -78,6 +78,7 @@
SetEnv OOD_ALLOWED_HOSTS "8.8.8.8,example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/output/auth_deb.conf b/ood-portal-generator/spec/fixtures/output/auth_deb.conf
index 21154935e2..c4a2b51cbd 100644
--- a/ood-portal-generator/spec/fixtures/output/auth_deb.conf
+++ b/ood-portal-generator/spec/fixtures/output/auth_deb.conf
@@ -78,6 +78,7 @@
SetEnv OOD_ALLOWED_HOSTS "8.8.8.8,example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/spec/fixtures/output/custom_directives.conf b/ood-portal-generator/spec/fixtures/output/custom_directives.conf
index 4d2ebce7ff..973d77c714 100644
--- a/ood-portal-generator/spec/fixtures/output/custom_directives.conf
+++ b/ood-portal-generator/spec/fixtures/output/custom_directives.conf
@@ -81,6 +81,9 @@
SetEnv SPECIAL_VHOST_ENV_VAR custom_vhost
SetEnv SECOND_VHOST_VAR custom_vhost2
SetEnv INDENTED_VHOST_VAR custom_vhost3
+
+ SetEnv SPECIAL_VHOST_LOCATION_ENV_VAR custom_vhost4
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
diff --git a/ood-portal-generator/spec/fixtures/output/custom_location_directives.conf b/ood-portal-generator/spec/fixtures/output/custom_location_directives.conf
index 818c8e56e6..d8cfff5c8e 100644
--- a/ood-portal-generator/spec/fixtures/output/custom_location_directives.conf
+++ b/ood-portal-generator/spec/fixtures/output/custom_location_directives.conf
@@ -78,6 +78,7 @@
SetEnv OOD_ALLOWED_HOSTS "8.8.8.8,example.com"
+
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
diff --git a/ood-portal-generator/templates/ood-portal.conf.erb b/ood-portal-generator/templates/ood-portal.conf.erb
index 64bfa5a6be..6ad5bbeba5 100644
--- a/ood-portal-generator/templates/ood-portal.conf.erb
+++ b/ood-portal-generator/templates/ood-portal.conf.erb
@@ -192,12 +192,10 @@ Listen <%= addr_port %>
SetEnv OOD_ALLOWED_HOSTS "<%= @allowed_hosts.join(',') %>"
<%- end -%>
- <%- if @custom_vhost_directives -%>
- <%- @custom_vhost_directives.each_line do |line| -%>
- <%= line -%>
+ <%- @custom_vhost_directives.to_a.each do |line| -%>
+ <%= line %>
<%- end -%>
- <%- end -%>
#
# Below is used for sub-uri's this Open OnDemand portal supports
#
@@ -227,10 +225,8 @@ Listen <%= addr_port %>
<%= line %>
<%- end -%>
- <%- if @custom_location_directives -%>
- <%- @custom_location_directives.each_line do |line| -%>
- <%= line -%>
- <%- end -%>
+ <%- @custom_location_directives.to_a.each do |line| -%>
+ <%= line %>
<%- end -%>
# ProxyPassReverse implementation
@@ -258,10 +254,8 @@ Listen <%= addr_port %>
<%= line %>
<%- end -%>
- <%- if @custom_location_directives -%>
- <%- @custom_location_directives.each_line do |line| -%>
- <%= line -%>
- <%- end -%>
+ <%- @custom_location_directives.to_a.each do |line| -%>
+ <%= line %>
<%- end -%>
# ProxyPassReverse implementation
@@ -290,10 +284,8 @@ Listen <%= addr_port %>
<%= line %>
<%- end -%>
- <%- if @custom_location_directives -%>
- <%- @custom_location_directives.each_line do |line| -%>
- <%= line -%>
- <%- end -%>
+ <%- @custom_location_directives.to_a.each do |line| -%>
+ <%= line %>
<%- end -%>
ProxyPreserveHost On
@@ -329,10 +321,8 @@ Listen <%= addr_port %>
<%= line %>
<%- end -%>
- <%- if @custom_location_directives -%>
- <%- @custom_location_directives.each_line do |line| -%>
- <%= line -%>
- <%- end -%>
+ <%- @custom_location_directives.to_a.each do |line| -%>
+ <%= line %>
<%- end -%>
LuaHookFixups nginx.lua nginx_handler
@@ -368,10 +358,8 @@ Listen <%= addr_port %>
<%= line %>
<%- end -%>
- <%- if @custom_location_directives -%>
- <%- @custom_location_directives.each_line do |line| -%>
- <%= line -%>
- <%- end -%>
+ <%- @custom_location_directives.to_a.each do |line| -%>
+ <%= line %>
<%- end -%>
<%- end -%>