Skip to content

Commit 730f16f

Browse files
committed
Merge branch '#9'
2 parents c3e2304 + 6f3107f commit 730f16f

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ debops.apache v0.1.0 - unreleased
1717
Added
1818
~~~~~
1919

20+
- Add :envvar:`apache__redirect_to_https` to control the role's default behaviour for
21+
redirecting to https. [muelli_]
22+
2023
- Initial coding and design. [ypid_]
2124

2225
- Add/Set the default `Referrer Policy`_ to ``no-referrer`` and made it

defaults/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,13 @@ apache__https_enabled: '{{ ansible_local|d() and ansible_local.pki|d() and
466466
(ansible_local.pki.enabled|d() | bool) and
467467
apache__https_listen|length > 0 }}'
468468

469+
# ]]]
470+
# .. envvar:: apache__redirect_to_https [[[
471+
#
472+
# This defines the default for each vhost's ``redirect_to_https`` variable.
473+
# Defaults to ``True``.
474+
apache__redirect_to_https: True
475+
469476
# ]]]
470477
# PKI [[[
471478
# ~~~~~~~

docs/defaults-detailed.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ Refer to the `Apache Redirect directive documentation`_ for details.
328328
HTTPS, by default 301 Moved Permanently.
329329

330330
``redirect_to_https``
331-
Optional, boolean. Defaults to ``True``
331+
Optional, boolean. Defaults to :envvar:`apache__redirect_to_https`
332332
If ``True``, redirect connection from HTTP to the HTTPS version of the site.
333333
Set to ``False`` to allow to serve the website via HTTP and HTTPS and don't
334334
redirect HTTP to HTTPS.

templates/etc/apache2/sites-available/apache__tpl_macros.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ ErrorLog ${APACHE_LOG_DIR}/{{ sanitized_name }}_error.log
127127
{% set apache__tpl_status_enabled = item.status_enabled|d(apache__status_for_vhost_enabled) | bool %}
128128
{{ get_server_status_directives(item, apache__tpl_status_enabled) -}}
129129
{% if apache__tpl_status_enabled|bool and (
130-
(mode == 'http' and (item.redirect_http|d() or item.redirect_to_https|d(https_enabled) | bool)) or
130+
(mode == 'http' and (item.redirect_http|d() or item.redirect_to_https|d(apache__redirect_to_https) | bool)) or
131131
(mode == 'https' and item.redirect_https|d())
132132
) %}
133133
RewriteEngine On
@@ -136,7 +136,7 @@ RewriteRule "^{{ item.status_location|d(apache__status_location) }}" "-" [L]
136136
{% endif %}
137137
{% if mode == 'http' and item.redirect_http|d() %}
138138
{{ get_redirect(item.redirect_http_code|d(307), "/", item.redirect_http, apache__tpl_use_redirect_module) }}
139-
{% elif mode == 'http' and item.redirect_to_https|d(https_enabled) | bool %}
139+
{% elif mode == 'http' and item.redirect_to_https|d(apache__redirect_to_https) | bool %}
140140
{{ get_redirect(item.redirect_to_https_with_code|d("301"), "/", "https://" + (debops__tpl_macros.get_yaml_list_for_elem(item.name) | from_yaml)[0], apache__tpl_use_redirect_module) }}
141141
{% elif mode == 'https' and item.redirect_https|d() %}
142142
{{ get_redirect(item.redirect_https_code|d(307), "/", item.redirect_https, apache__tpl_use_redirect_module) }}
@@ -255,7 +255,7 @@ Header {{ apache__tpl_directive_options }} X-Content-Type-Options "{{ item.http_
255255
{% macro get_common_headers(item) %}{# [[[ #}
256256
{% if item.http_clacks_overhead|d(apache__http_clacks_overhead|d(True)) | bool %}
257257
{#
258-
# Respect the will of the DebOps Creater.
258+
# Respect the will of the DebOps Creator.
259259
# Ref: https://github.com/debops/ansible-nginx/commit/d6cd455c68a7584b2592053fd98d3e539054e09a
260260
#}
261261
Header always set X-Clacks-Overhead "GNU Terry Pratchett"

0 commit comments

Comments
 (0)