diff --git a/README.md b/README.md index c4d9786..9915ff9 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ The following options are possible: * **port**(optional, defaults to 80) the port on the target container * **ip**(optional, defaults to listen on all IPs) the IP on which the proxy should listen. * **location**(optional) if the proxied web application is not running on the /-path +* **body_size**(optional, defaults to 1MB) the allowed maximal body size as defined in http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size ## Starting the container diff --git a/nginx_proxy.py b/nginx_proxy.py index 0286ef5..5c95ca3 100755 --- a/nginx_proxy.py +++ b/nginx_proxy.py @@ -15,7 +15,7 @@ server { listen $listen; server_name $names; location / { - client_max_body_size 100m; + client_max_body_size $body_size; client_body_timeout 300s; proxy_set_header X-Real-IP $$remote_addr; proxy_set_header X-Forwarded-For $$remote_addr; @@ -33,7 +33,7 @@ server { return 301 $$scheme://$name/$location; } location /$location { - client_max_body_size 100m; + client_max_body_size $body_size; client_body_timeout 300s; proxy_set_header X-Real-IP $$remote_addr; proxy_set_header X-Forwarded-For $$remote_addr; @@ -100,6 +100,7 @@ def handle_container(id): 'location': get_if_available(proxy_data, 'location', ''), 'names': get_if_available(proxy_data, 'server_names', '').replace(';', ' '), 'port': get_if_available(proxy_data, 'port', 80), + 'body_size': get_if_available(proxy_data, 'body_size', '1m'), 'listen': '*:80' } logging.info('writing to %sproxy_%s', target_path, id)