Add boolean auth parameter `allow_read`
Boolean auth parameter `allow_read` can be used to permit read access for
not authorized users.
site:
restricted_site:
...
auth:
allow_read: true
engine: basic
Change-Id: I23fd2f74c5b1eb29b7a96b3d1432768326bdc0de
diff --git a/nginx/files/_auth.conf b/nginx/files/_auth.conf
index 2cc3653..0db8d42 100644
--- a/nginx/files/_auth.conf
+++ b/nginx/files/_auth.conf
@@ -1,5 +1,9 @@
{%- if site.auth is defined %}
+ {%- set allow_read = site.auth.get('allow_read', False) %}
+ {%- if allow_read %}
+ limit_except GET {
+ {%- endif %}
{%- if site.auth.engine == 'basic' %}
auth_basic "Restricted";
{%- if site.auth.htpasswd is defined %}
@@ -8,4 +12,7 @@
auth_basic_user_file /etc/nginx/htpasswd;
{%- endif %}
{%- endif %}
+ {%- if allow_read %}
+ }
+ {%- endif %}
{%- endif %}