pluosi / app-host

应用内网发布 | iOS OTA (Over-the-Air) | APP publish website like fir.im | 适用于企业 iOS & Android 内网发布测试使用,方便管理和分发 APP 包
MIT License
2.05k stars 411 forks source link

[Error]413 Request Entity Too Large,filesize>1000m,curl提交不了 #149

Open hlongcheng opened 2 years ago

hlongcheng commented 2 years ago

包体大于1000m,提交报413,小于1000m时提交正常。

hlongcheng commented 2 years ago

改了 client_max_body_size 2048m; client_body_buffer_size 2048k; fastcgi_intercept_errors on; 还是报413

hlongcheng commented 2 years ago

[error] 37273#0: *2217 client intended to send too large body: 1174057701 bytes, client: 172.xx.xx.xx, server: app.xxx.cn, request: "POST /api/pkgs HTTP/1.1", host: "xxx.xx.xx" 包体大小1190m左右,试了多种方案没解决,求助

tinyc-z commented 2 years ago

我去,这么大的包????进 docker 里面改,docker 里面有个 ng

hlongcheng commented 2 years ago

nginx.conf配置内容

user root;

events { worker_connections 1024; }

http { server { listen 443 ssl; server_name xxx.xxx.xx; ssl on;

    access_log /root/nginx_cmd/log/access.log;
    error_log /root/nginx_cmd/log/error.log;

    ssl_certificate /cert/xxx.ip.xxx.xx+4.pem;
    ssl_certificate_key /cert/xxx.ip.xxx.xx+4-key.pem;

    ssl_session_timeout 5m; 

    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
    #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_protocols TLSv1.2;
    ssl_prefer_server_ciphers on; 

    root /root/shared/public;

    client_max_body_size 2048m;
    #client_body_buffer_size 2048m;
    fastcgi_intercept_errors on;

    proxy_connect_timeout 75;
    proxy_send_timeout 75;
    proxy_read_timeout 75;
    proxy_buffer_size 4k;
    proxy_buffers 4 32k;

    location ~ ^/(uploads)/ {
        expires max;
        add_header Cache-Control public;
        client_max_body_size 2048m;
        break;
    }

    location / {
        #proxy_redirect    off;
        proxy_set_header  Host              $http_host;
        proxy_set_header  X-Real-IP         $remote_addr;
        proxy_set_header  X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;

        if ( $http_x_forwarded_port = "" ){
            set $http_x_forwarded_port "3000";
        }

        proxy_set_header X-Forwarded-Port $server_port;

        if (!-f $request_filename) {
            proxy_pass http://xxx.xxx.xx:3000;
        }
    }

    server{
        listen 80;
        server_name xxx.xxx.xx;
        rewrite ^(.*)$ https://$host$1 permanent;
    }
}

}

hlongcheng commented 2 years ago

我去,这么大的包????进 docker 里面改,docker 里面有个 ng

有改过,还是提示413

hlongcheng commented 2 years ago

nginx 源码 if (r->headers_in.content_length_n != -1 && !r->discard_body && clcf->client_max_body_size && clcf->client_max_body_size < r->headers_in.content_length_n) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "client intended to send too large body: %O bytes", r->headers_in.content_length_n);

    r->expect_tested = 1;
    (void) ngx_http_discard_request_body(r);
    ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);
    return NGX_OK;
}
{
    ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                  "client intended to send too large body: %O bytes",
                  r->headers_in.content_length_n);

    r->expect_tested = 1;
    (void) ngx_http_discard_request_body(r);
    ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);
    return NGX_OK;
}
Dejavu0709 commented 1 year ago

有解决吗?遇到同样的问题