Merge ~hloeung/content-cache-charm:nginx-config into content-cache-charm:master

Proposed by Haw Loeung
Status: Work in progress
Proposed branch: ~hloeung/content-cache-charm:nginx-config
Merge into: content-cache-charm:master
Diff against target: 28 lines (+10/-1)
1 file modified
templates/nginx_cfg.tmpl (+10/-1)
Reviewer Review Type Date Requested Status
Content Cache Charmers Pending
Review via email: mp+412419@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Haw Loeung (hloeung) :

Unmerged commits

258154b... by Haw Loeung

WIP

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/templates/nginx_cfg.tmpl b/templates/nginx_cfg.tmpl
2index c3d2ed9..8515864 100644
3--- a/templates/nginx_cfg.tmpl
4+++ b/templates/nginx_cfg.tmpl
5@@ -1,5 +1,13 @@
6 proxy_cache_path {{cache_path}}/{{site}} use_temp_path=off levels=1:2 keys_zone={{keys_zone}}:10m {% if cache_inactive_time %}inactive={{cache_inactive_time}} {% endif %}max_size={{cache_max_size}};
7
8+{%- for location, conf in locations.items() %}
9+upstream {{conf['backend_name']}} {
10+ server {{conf['backend']}};
11+
12+ keepalive 16;
13+}
14+{% endfor %}
15+
16 server {
17 server_name {{site_name}};
18 listen {% if address %}{{address}}:{% endif %}{{port}}{% if reuseport %} reuseport{% endif %};
19@@ -12,7 +20,8 @@ server {
20 location {% if conf['modifier'] %}{{conf['modifier']}} {% endif %}{{ location }} {
21 {%- if conf['backend'] %}
22 proxy_http_version 1.1;
23- proxy_pass {{conf['backend']}};
24+ proxy_pass http://{{conf['backend_name']}};
25+ proxy_set_header Connection "";
26 proxy_set_header Host "{{site_name}}";
27 # Removed the following headers to avoid cache poisoning.
28 proxy_set_header Forwarded "";

Subscribers

People subscribed via source and target branches