Skip to content

Commit

Permalink
Added support for multiple domains for Apache config in portal generator
Browse files Browse the repository at this point in the history
  • Loading branch information
abujeda committed Dec 21, 2023
1 parent bf38433 commit d9833a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions ood-portal-generator/lib/ood_portal_generator/view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def initialize(opts = {})
@server_aliases = opts.fetch(:server_aliases, [])
@proxy_server = opts.fetch(:proxy_server, servername)
@allowed_hosts = allowed_hosts
@multiple_hosts = opts.fetch(:multiple_hosts, false)
@port = opts.fetch(:port, @ssl ? "443" : "80")
if OodPortalGenerator.debian?
@logroot = opts.fetch(:logroot, "/var/log/apache2")
Expand Down
6 changes: 6 additions & 0 deletions ood-portal-generator/share/ood_portal_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
# Default: The value of servername
#proxy_server: null

# To allow access to the server on different domains
# Example:
# multiple_hosts: true
# Default: false
#multiple_hosts: false

# The port specification for the Virtual Host
# Example:
# port: 8080
Expand Down
2 changes: 1 addition & 1 deletion ood-portal-generator/templates/ood-portal.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Listen <%= addr_port %>
CustomLog "<%= @accesslog %>" combined
<%- end -%>
<%- if @servername && @use_rewrites -%>
<%- if !@multiple_hosts && @servername && @use_rewrites -%>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(<%= @proxy_server %>(:<%= @port %>)?)?$ [NC]
RewriteRule ^(.*) <%= @ssl ? "https" : "http" %>://<%= @proxy_server %>:<%= @port %>$1 [R=301,NE,L]
Expand Down

0 comments on commit d9833a2

Please sign in to comment.