Skip to content

Commit

Permalink
Merge pull request #40 from OSC/disable-rewrite
Browse files Browse the repository at this point in the history
Support disabling RewriteEngine
  • Loading branch information
ericfranz authored Jun 27, 2019
2 parents b16c43a + fbbdd27 commit cf5d15b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ood-portal-generator/lib/ood_portal_generator/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module OodPortalGenerator
# The current version of OodPortalGenerator
VERSION= "0.8.0"
VERSION= "0.9.0"
end
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 @@ -14,6 +14,7 @@ def initialize(opts = {})
@servername = opts.fetch(:servername, nil)
@port = opts.fetch(:port, @ssl ? "443" : "80")
@logroot = opts.fetch(:logroot, "logs")
@use_rewrites = opts.fetch(:use_rewrites, true)
@lua_root = opts.fetch(:lua_root, "/opt/ood/mod_ood_proxy/lib")
@lua_log_level = opts.fetch(:lua_log_level, "info")
@user_map_cmd = opts.fetch(:user_map_cmd, "/opt/ood/ood_auth_map/bin/ood_auth_map.regex")
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 @@ -35,6 +35,12 @@
# Default: 'logs' (this is relative to ServerRoot)
#logroot: 'logs'

# Should RewriteEngine be used
# Example:
# use_rewrites: false
# Default: true
#use_rewrites: true

# Root directory of the Lua handler code
# Example:
# lua_root: '/path/to/lua/handlers'
Expand Down
4 changes: 3 additions & 1 deletion ood-portal-generator/templates/ood-portal.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Listen <%= addr_port %>
<% end -%>
<% end -%>

<% if @ssl -%>
<% if @ssl && @use_rewrites -%>
# Redirect all http traffic to the https Open OnDemand portal URI
# http://*:<%= @port %>
# #=> <%= @ssl ? "https" : "http" %>://<%= @servername || "localhost" %>:<%= @port %>
Expand All @@ -66,10 +66,12 @@ Listen <%= addr_port %>
ErrorLog "<%= @logroot %>/<%= @servername %>_error<%= "_ssl" if @ssl %>.log"
CustomLog "<%= @logroot %>/<%= @servername %>_access<%= "_ssl" if @ssl %>.log" combined

<%- if @use_rewrites -%>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(<%= @servername %>(:<%= @port %>)?)?$ [NC]
RewriteRule ^(.*) <%= @ssl ? "https" : "http" %>://<%= @servername %>:<%= @port %>$1 [R=301,NE,L]
<%- end -%>
<%- end -%>

<%- if @ssl -%>
SSLEngine On
Expand Down

0 comments on commit cf5d15b

Please sign in to comment.