Giter Site home page Giter Site logo

download via nginx proxy max 1 GB about sharry HOT 3 CLOSED

eikek avatar eikek commented on May 22, 2024
download via nginx proxy max 1 GB

from sharry.

Comments (3)

eikek avatar eikek commented on May 22, 2024

Thank you!

I'm not so experienced with nginx. I just tried with my setup and it worked for me downloading a 2.2G file (tried with Chromium 80.0.3987.163 and wget 1.20 on nginx 1.16.1). My config is this

location / {
    proxy_pass http://sharry-intern:9090;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    client_max_body_size 105M;
    proxy_send_timeout   300s;
    proxy_read_timeout   300s;
    send_timeout         300s;
}

Do you have any idea why this can work here?

The doc says "The zero value disables buffering of responses to temporary files." Do you know if this means that the response must fit in memory (if buffering is enabled)?

Maybe it's even better to disable buffering responses from the body, wdyt?

from sharry.

hoedlmoser avatar hoedlmoser commented on May 22, 2024

here its Chromium 80.0.3987.163, nginx 1.14.2 for sharry and an other instance for https-offloading (on an other virtual machine) of same version.

Do you have any idea why this can work here?

maybe you set proxy_buffering off somewhere globally? thats what I've done on my https-offloading nginx. check with nginx -T and search for this parameter.

they are describing here https://trac.nginx.org/nginx/ticket/1472 kind of timeout by backend: "if the limit is reached, nginx will stop reading from the backend till all disk-buffered data are sent to the client. This in turn can result in a send timeout on the backend side."
my nginx error log reports such a backend timeout.
2020/04/11 16:31:59 [error] 791#791: *176597 readv() failed (104: Connection reset by peer) while reading upstream, client: 10.21.11.66, server: sharry.rekmp.net, request: "GET /api/v2/sec/share/CeR3a5qjEBd-v3pJ7hnEW14-1inSKT76Nqp-8S7nsVQxbzX/file/HHyNz1JLBjx-9SDGQmirhze-VXSRWKw8ufZ-SLBN6xK7Sa7 HTTP/1.0", upstream: "http://127.0.0.1:9090/api/v2/sec/share/CeR3a5qjEBd-v3pJ7hnEW14-1inSKT76Nqp-8S7nsVQxbzX/file/HHyNz1JLBjx-9SDGQmirhze-VXSRWKw8ufZ-SLBN6xK7Sa7", host: "sharry.rekmp.net"
maybe your downlink is just that fast that you will not experience that backend timeout.

Do you know if this means that the response must fit in memory (if buffering is enabled)?

if I do not misunderstand http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering and https://www.scalescale.com/tips/nginx/optimizing-nginx-for-serving-files-bigger-than-1gb/ I would clearly say: no, need not fit into memory.

Maybe it's even better to disable buffering responses from the body, wdyt?

I would propose disabling buffering in any case. buffering means loosing bandwith you later do not have.

this is my config

  location / {
    proxy_pass http://localhost:9090;
    include /etc/nginx/proxy_params;

    # https://eikek.github.io/sharry/doc/reverseproxy#nginx
    proxy_http_version 1.1;
    #proxy_set_header Upgrade $http_upgrade;
    #proxy_set_header Connection $connection_upgrade;
    client_max_body_size 105M;
    proxy_max_temp_file_size 0;
    proxy_send_timeout   300s;
    proxy_read_timeout   300s;
    send_timeout         300s;
    location = / {
      return 302 /app;
    }
  }

from sharry.

eikek avatar eikek commented on May 22, 2024

I see, thank you for all the details. Yes, I then also think it is better to disable buffering in nginx. This only introduces backpressure problems.

And yes, I usually test with a too good connection. I haven't tested with slow connections yet, which I should do more seriously. It also means to provide more options to configure the sharry http server, for example to set custom timeouts. Currently for slow connections, one can only use a lower chunk size (not 100M). I will invest into these things for the next release.

from sharry.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.