Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Allow specifying file upload limit
Browse files Browse the repository at this point in the history
  • Loading branch information
fao89 committed Mar 19, 2021
1 parent 3267ae8 commit d26a377
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/8212.feature
@@ -0,0 +1 @@
Allow specifying file upload limit
1 change: 1 addition & 0 deletions roles/pulp_webserver/README.md
Expand Up @@ -38,6 +38,7 @@ Role Variables
directory for ACME (letsencrypt) files or SSL certs. This is not to be confused with the Pulp
application's setting `STATIC_ROOT`, which is a function of Pulp itself (not the webserver) and servces
a different set of files.
- `pulp_client_max_body_size`: Sets the maximum allowed size of the client request body.

Plugin Webserver Configs
------------------------
Expand Down
4 changes: 4 additions & 0 deletions roles/pulp_webserver/defaults/main.yml
Expand Up @@ -31,3 +31,7 @@ pulp_webserver_https_port: 443
pulp_webserver_tls_key: ''
pulp_webserver_tls_cert: ''
pulp_webserver_tls_custom_ca_cert: ''
# Default values:
# https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
# https://httpd.apache.org/docs/2.0/mod/core.html#limitrequestbody
pulp_client_max_body_size: "{{ '1m' if pulp_webserver_server == 'nginx' else '0' }}"
1 change: 1 addition & 0 deletions roles/pulp_webserver/templates/nginx.conf.j2
Expand Up @@ -59,6 +59,7 @@ http {

# The default client_max_body_size is 1m. Clients uploading
# files larger than this will need to chunk said files.
client_max_body_size {{ pulp_client_max_body_size }};

# Gunicorn docs suggest this value.
keepalive_timeout 5;
Expand Down
3 changes: 3 additions & 0 deletions roles/pulp_webserver/templates/pulp-vhost.conf.j2
Expand Up @@ -4,6 +4,7 @@ Define pulp-api {{ __pulp_webserver_apache_api_bind }}
{% if pulp_webserver_disable_https | bool %}
<VirtualHost *:{{ pulp_webserver_http_port }}>
ServerName {{ pulp_webserver_httpd_servername }}
LimitRequestBody {{ pulp_client_max_body_size }}

## Logging
ErrorLog "{{ pulp_webserver_apache_log_dir }}/pulp_error.log"
Expand Down Expand Up @@ -35,11 +36,13 @@ Define pulp-api {{ __pulp_webserver_apache_api_bind }}
{% else %}
<VirtualHost *:{{ pulp_webserver_http_port }}>
ServerName {{ pulp_webserver_httpd_servername }}
LimitRequestBody {{ pulp_client_max_body_size }}
Redirect permanent / https://{{ pulp_webserver_httpd_servername }}/
</VirtualHost>

<VirtualHost *:{{ pulp_webserver_https_port }}>
ServerName {{ pulp_webserver_httpd_servername }}
LimitRequestBody {{ pulp_client_max_body_size }}

# static files that can change dynamically, or are needed for TLS
# purposes are served through the webserver.
Expand Down

0 comments on commit d26a377

Please sign in to comment.