bundles/nginx: proxy is a dict now, add some more configuration options
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2020-09-22 18:36:10 +02:00
parent d1672a9a45
commit 7ea85247e0
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 39 additions and 10 deletions

View file

@ -42,7 +42,9 @@ def nginx(metadata):
'vhosts': { 'vhosts': {
metadata.get('gitea/domain'): { metadata.get('gitea/domain'): {
'proxy': { 'proxy': {
'/': 'http://127.0.0.1:22000', '/': {
'target': 'http://127.0.0.1:22000',
},
}, },
}, },
}, },

View file

@ -36,16 +36,26 @@ server {
} }
% if proxy: % if proxy:
% for location, proxy_pass in proxy.items(): % for location, options in proxy.items():
location ${location} { location ${location} {
proxy_pass ${proxy_pass}; proxy_pass ${options['target']};
proxy_http_version ${options.get('http_version', '1.1')};
proxy_set_header Host ${domain}; proxy_set_header Host ${domain};
proxy_set_header X-Script-Name /; % if options.get('websockets', False):
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
% endif
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
% if node.metadata['nginx']['use_ssl_for_all_connections']: % if node.metadata['nginx']['use_ssl_for_all_connections']:
proxy_set_header X-Forwarded-Proto HTTPS; proxy_set_header X-Forwarded-Proto HTTPS;
% endif % endif
proxy_set_header X-Forwarded-Host ${domain}; proxy_set_header X-Forwarded-Host ${domain};
% for option, value in options.get('proxy_set_header', {}).items():
proxy_set_header ${option} ${value};
% endfor
% if location != '/':
proxy_set_header X-Script-Name ${location};
% endif
proxy_buffering off; proxy_buffering off;
} }
% endfor % endfor

View file

@ -19,8 +19,15 @@ nodes['home.octoprint-vielschichtigkeit'] = {
'use_ssl_for_all_connections': False, 'use_ssl_for_all_connections': False,
'vhosts': { 'vhosts': {
'vielschichtigkeit.franzi-home.kunbox.net': { 'vielschichtigkeit.franzi-home.kunbox.net': {
'do_not_set_content_security_headers': True,
'proxy': { 'proxy': {
'/': 'http://[::1]:22030/', '/': {
'target': 'http://[::1]:22030/',
'websockets': True,
'proxy_set_header': {
'X-Real-IP': '$remote_addr',
},
},
}, },
}, },
}, },

View file

@ -171,7 +171,9 @@ nodes['htz.ex42-1048908'] = {
'extras': True, 'extras': True,
'do_not_set_content_security_headers': True, 'do_not_set_content_security_headers': True,
'proxy': { 'proxy': {
'/': 'http://127.0.0.1:8184', '/': {
'target': 'http://127.0.0.1:8184',
},
}, },
}, },
'franzi.business': { 'franzi.business': {
@ -180,7 +182,9 @@ nodes['htz.ex42-1048908'] = {
}, },
'jenkins.kunsmann.eu': { 'jenkins.kunsmann.eu': {
'proxy': { 'proxy': {
'/': 'http://localhost:22010/', '/': {
'target': 'http://localhost:22010/',
},
}, },
}, },
'kunbox.net': {}, 'kunbox.net': {},
@ -203,17 +207,23 @@ nodes['htz.ex42-1048908'] = {
}, },
'rspamd.mx0.kunbox.net': { 'rspamd.mx0.kunbox.net': {
'proxy': { 'proxy': {
'/': 'http://localhost:11334/', '/': {
'target': 'http://localhost:11334/',
},
}, },
}, },
'rss.kunsmann.eu': { 'rss.kunsmann.eu': {
'proxy': { 'proxy': {
'/': 'http://localhost:8080/', '/': {
'target': 'http://localhost:8080/',
},
}, },
}, },
'travelynx.franzi.business': { 'travelynx.franzi.business': {
'proxy': { 'proxy': {
'/': 'http://127.0.0.1:22020', '/': {
'target': 'http://127.0.0.1:22020',
},
}, },
'extras': True, 'extras': True,
}, },