Redirect to HTTPS for governance.openstack.org

Unilaterally redirect any plain HTTP requests for the
governance.openstack.org site to HTTPS by making the
static-governance vhost template's *:80 VirtualHost block match the
one we use for our generic https-redirect vhost template.

Change-Id: I2f63314f505d2fa03764b9b3cfc53d1070372e7c
This commit is contained in:
Jeremy Stanley 2016-12-07 20:09:46 +00:00 committed by Thierry Carrez
parent 12a99645a0
commit c95d0e59e0

View File

@ -5,39 +5,12 @@
<VirtualHost *:80> <VirtualHost *:80>
ServerName <%= @vhost_name %> ServerName <%= @vhost_name %>
<% if @serveraliases.is_a? Array -%> <% if @serveraliases.is_a? Array -%>
# Permanently redirect these ServerAlias entries to ServerName
<% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> <% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%>
<% elsif @serveraliases != '' -%> <% elsif @serveraliases != '' -%>
<%= " ServerAlias #{@serveraliases}" %> <%= " ServerAlias #{@serveraliases}" %>
RewriteEngine On
RewriteCond %{HTTP_HOST} !<%= @vhost_name %>$ [NC]
RewriteRule ^/(.*)$ http://<%= @vhost_name %>/$1 [L,R=301]
<% end -%> <% end -%>
DocumentRoot <%= @docroot %> RewriteEngine On
RewriteRule ^/(.*) https://<%= @vhost_name %>/$1 [last,redirect=permanent]
# Alias other folders
<% scope.lookupvar('openstack_project::static::governance_aliases').each do |a, d| -%>
Alias "<%= a %>" "<%= d %>"
<% end -%>
<% scope.lookupvar('openstack_project::static::governance_directories').each do |dirname| -%>
<Directory <%= dirname %>>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Satisfy Any
Require all granted
</Directory>
<% end -%>
<Directory /srv/static/governance/badges>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Satisfy Any
Require all granted
<IfModule mod_headers.c>
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</IfModule>
ErrorDocument 404 /badges/project-unofficial.svg
</Directory>
LogLevel warn LogLevel warn
ErrorLog /var/log/apache2/<%= @vhost_name %>_error.log ErrorLog /var/log/apache2/<%= @vhost_name %>_error.log
CustomLog /var/log/apache2/<%= @vhost_name %>_access.log combined CustomLog /var/log/apache2/<%= @vhost_name %>_access.log combined