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

[Question] mwdb-web complains about too large body but max_upload_size isn't set to anything #927

Closed
kudrew opened this issue Mar 14, 2024 · 3 comments · Fixed by #930
Closed
Labels
type:improvement Small improvement of existing feature type:question Further information is requested

Comments

@kudrew
Copy link

kudrew commented Mar 14, 2024

I'm trying to upload large files (100mb+) through /upload and mwdb-web is reporting back status code 413 with the following log message

2024/03/14 19:15:42 [error] 12#12: *209 client intended to send too large body: 88220262 bytes, client: X.X.X.X, server: mwdb-web, request: "POST /api/file HTTP/1.1", host: "xyz.xyz", referrer: "https://xyz.xyz/upload"
"POST /api/file HTTP/1.1" 413 585 "https://xyz.xyz/upload" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" "X.X.X.X, X.X.X.X"

I've read #756 and I haven't included any related configurations related to "max_upload_size / MAX_UPLOAD_SIZE", so I'm trying to figure out how can I increase the file upload size limitation.

Thanks.

@psrok1
Copy link
Member

psrok1 commented Mar 15, 2024

Hi,

Another upload size limitation you're hitting is introduced by default Nginx configuration used in mwdb-web Docker image:

I think this parameter should be somehow parametrized by env variables. nginx Docker base image already supports it by applying envsubst on template and it's already used for injecting correct PROXY_BACKEND_URL into configuration.

Right now, the only possible workaround is to build own Docker image using modified copy of nginx.conf.template with higher client_max_body_size:

FROM dr.cert.pl/dockerhub-proxy/certpl/mwdb-web:v2.12.0
COPY nginx.conf.template /etc/nginx/conf.d/default.conf.template

@psrok1 psrok1 added type:improvement Small improvement of existing feature type:question Further information is requested labels Mar 15, 2024
@kudrew
Copy link
Author

kudrew commented Mar 19, 2024

Thanks @psrok1

to further enhance, we have added the following nginx.conf like so below:

server {
    listen 80;
    server_name mwdb-web;
    root /usr/share/nginx/html;

    client_max_body_size 0;
    client_body_timeout 600s;
    send_timeout 600s;

    location /api/ {
        proxy_pass ${PROXY_BACKEND_URL}/api/;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_read_timeout 600s;
        proxy_connect_timeout 600s;
    }

    location = /api {
        absolute_redirect off;
        return 301 /api/;
    }

    location / {
        try_files $uri /index.html =404;
    }
}

@psrok1
Copy link
Member

psrok1 commented Mar 28, 2024

I've added env var support in our nginx.conf.template. I also found that our nginx.conf.template is placed in a bit different path than nginx:stable entrypoint expects. If you want to use newer images that includes changes from #930, remember to change the path of nginx.conf.template as follows:

FROM dr.cert.pl/dockerhub-proxy/certpl/mwdb-web:master
- COPY nginx.conf.template /etc/nginx/conf.d/default.conf.template
+ COPY nginx.conf.template /etc/nginx/templates/default.conf.template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:improvement Small improvement of existing feature type:question Further information is requested
Projects
None yet
2 participants