Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit request bodies size (default 250MB) #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM caddy:2.3.0-alpine
FROM caddy:2.7-alpine

LABEL org.opencontainers.image.title="OpenSlides Proxy"
LABEL org.opencontainers.image.description="The proxy is the entrypoint for traffic going into an OpenSlides instance."
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM caddy:2.3.0-alpine
FROM caddy:2.7-alpine

RUN apk update && apk add --no-cache jq gettext

Expand Down
14 changes: 13 additions & 1 deletion caddy_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"servers": {
"srv0": {
"listen": [":8000"],
"allow_h2c": true,
"protocols": ["h1","h2"],
"routes": [
{
"handle": [
Expand Down Expand Up @@ -61,6 +61,18 @@
},
{
"handle": [
{
"handler": "headers",
"response": {
"add": {
"Request-Body-Max-Size": ["$REQUEST_BODY_MAX_SIZE"]
}
}
},
{
"handler": "request_body",
"max_size": $REQUEST_BODY_MAX_SIZE
},
{
"handler": "reverse_proxy",
"upstreams": [
Expand Down
1 change: 1 addition & 0 deletions entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ MEDIA_HOST="${MEDIA_HOST:-media}" MEDIA_PORT="${MEDIA_PORT:-9006}" \
MANAGE_HOST="${MANAGE_HOST:-manage}" MANAGE_PORT="${MANAGE_PORT:-9008}" \
CLIENT_HOST="${CLIENT_HOST:-client}" CLIENT_PORT="${CLIENT_PORT:-9001}" \
VOTE_HOST="${VOTE_HOST:-vote}" VOTE_PORT="${VOTE_PORT:-9013}" \
REQUEST_BODY_MAX_SIZE="${REQUEST_BODY_MAX_SIZE:-250MB}" \
envsubst < "$config" > "$config.out" && mv -f "$config.out" "$config"

jq_write() {
Expand Down