Add global reverse proxy timeout settings (fixes #74)

This commit is contained in:
MattIPv4
2020-06-11 15:46:51 +01:00
parent 0c61f2a87a
commit 13b5220b93
10 changed files with 271 additions and 17 deletions

View File

@@ -24,12 +24,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
export default () => {
export default global => {
const config = {};
config.proxy_http_version = '1.1';
config.proxy_cache_bypass = '$http_upgrade';
config['# Proxy headers'] = '';
config['proxy_set_header Upgrade'] = '$http_upgrade';
config['proxy_set_header Connection'] = '"upgrade"';
config['proxy_set_header Host'] = '$host';
@@ -39,6 +40,11 @@ export default () => {
config['proxy_set_header X-Forwarded-Host'] = '$host';
config['proxy_set_header X-Forwarded-Port'] = '$server_port';
config['# Proxy timeouts'] = '';
config['proxy_connect_timeout'] = global.reverseProxy.proxyConnectTimeout.computed;
config['proxy_send_timeout'] = global.reverseProxy.proxySendTimeout.computed;
config['proxy_read_timeout'] = global.reverseProxy.proxyReadTimeout.computed;
// Done!
return config;
};

View File

@@ -200,7 +200,7 @@ export default (domain, domains, global) => {
locConf.push(['include', 'nginxconfig.io/proxy.conf']);
} else {
// Unified
locConf.push(...Object.entries(proxyConf()));
locConf.push(...Object.entries(proxyConf(global)));
}
serverConfig.push(['# reverse proxy', '']);