Skip to content

Commit

Permalink
Add location_extra webserver option. Fixes #35.
Browse files Browse the repository at this point in the history
  • Loading branch information
smcmahon committed Jun 29, 2016
1 parent 23bb8c2 commit d70bf95
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
1.2.9 (unreleased)

- Add location_extra webserver option. Fixes #35.
[smcmahon]

- Always run Ansible version check.
[djowett]

Expand Down
9 changes: 9 additions & 0 deletions docs/webserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ Let's take a look at a common use for these options:
This is a *redirect to https* setting.

``location_extra`` may be used to add directives *within* the location block:

.. code-block:: yaml
- hostname: plone.com
protocol: http
location_extra: |
auth_basic "Private Demo - please enter your credentials";
auth_basic_user_file /etc/nginx/htpasswd;
Status and monitoring
~~~~~~~~~~~~~~~~~~~~~
Expand Down
5 changes: 4 additions & 1 deletion roles/nginx/templates/host.j2
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ server {

{% if item.get('zodb_path') != None %}
location / {
rewrite ^/(.*)$ /VirtualHostBase/$vh_protocol/$server_name:$vh_port{{ item.zodb_path }}/VirtualHostRoot/$1 break;
auth_basic off;
{% if item.get('location_extra') != None %}
{{ item.location_extra }}
{% endif %}
rewrite ^/(.*)$ /VirtualHostBase/$vh_protocol/$server_name:$vh_port{{ item.zodb_path }}/VirtualHostRoot/$1 break;
proxy_pass http://localhost:{{ proxycache_port|default('6081') }};
}
location ~ /manage_ {
Expand Down
2 changes: 2 additions & 0 deletions sample-multiserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,7 @@ playbook_plones:
webserver_virtualhosts:
- hostname: localhost
zodb_path: /Plone
extra: "# test comment here; added via extra"
location_extra: "# test comment here; added via location_extra"


0 comments on commit d70bf95

Please sign in to comment.