root-gg / plik

Plik is a temporary file upload system (Wetransfer like) in Go.
https://plik.root.gg
Other
1.47k stars 168 forks source link

Streaming function uploads to server immediately. #449

Closed bleomycin closed 1 year ago

bleomycin commented 2 years ago

Streaming function uploads to server immediately. Tested with Microsoft Edge and Google Chrome on windows 11. Toggle the streaming option, select file to upload, click upload button to generate link and the file begins uploading to the server immediately. Streaming function does not seem to work? Please let me know if there is anything else I can do to help debug.

Plik Version : 1.3.6 go1.18.2 linux/amd64

docker-compose.yml

version: "2"
services:
  plik:
    image: rootgg/plik:latest
    container_name: plik
    volumes:
      - /opt/docker/plik/config/plikd.cfg:/home/plik/server/plikd.cfg
      - /opt/docker/plik/config/data:/data
    ports:
      - 8081:8080   
    restart: "unless-stopped"
[06/28/2022 21:28:13][INFO    ][[192.168.208.1][3kOh7W38hO2sVT2n]] POST /upload [200 OK] (858.312µs)
[06/28/2022 21:28:13][INFO    ][[192.168.208.1]] GET /qrcode?url=https%3A%2F%2Fsend.mydomain.com%2F%23%2F%3Fid%3D3kOh7W38hO2sVT2n&size=200 [200 OK] (9.097863ms)
camathieu commented 2 years ago

Do you have any reverse proxy setup in front of Plik ? We have seen many times where the browser uploads the file to the buffer of a reverse proxy.

camathieu commented 2 years ago

ow to disable nginx buffering ? By default nginx buffers large HTTP requests and reponses to a temporary file. This behaviour leads to unnecessary disk load and slower transfers. This should be turned off (>1.7.12) for /file and /stream paths. You might also want to increase buffers size.

Detailed documentation : http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering

proxy_buffering off;
proxy_request_buffering off;
proxy_http_version 1.1;
proxy_buffer_size 1M;
proxy_buffers 8 1M;
client_body_buffer_size 1M;
camathieu commented 1 year ago

Closing this issue as it is most likely related to user setup more than Plik code. Feel free to reopen if the issue arise without any reverse proxy.