ipfs / ipfs/kubo

The progress=true option breaks upload via an Nginx reverse proxy

Open
#6,402 35 comments 1 reaction 0 assignees View on GitHub
topic/docs-ipfs
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

#### Version

I'm using a docker container: `ipfs/go-ipfs:v0.4.20``
```
/ # ipfs version --all
go-ipfs version: 0.4.20-
Repo version: 7
System version: amd64/linux
Golang version: go1.12.4
```

#### Description

When using the `progress=true` flag with the `/api/v0/add` API path the upload just stops midway for files larget than a few MB(the larger the more likely to stop).

#### Steps to reproduce

0. Configure an Nginx reverse proxy for port `5001`:
```nginx
server {
listen 8888;

proxy_set_header Connection "";
proxy_http_version 1.1;

proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;

client_max_body_size 50m;

location /api/v0/add {
proxy_pass http://localhost:5001;
}
}
```

1. Create a 4MB file:
```
dd if=/dev/urandom of=file.txt count=4 bs=1M
```

2. Attempt to upload it with `progress=true` enabled:
```
curl -v -F 'file=@file.txt' 'http://localhost:8888/api/v0/add?progress=true'
...(omitted)...
{"Name":"file.txt","Bytes":262144}
...(omitted)..,

{"Name":"file.txt","Hash":"Qmav1M4BBDmN2pYAy5GoetdHqV7MJX489NnKTUPi9BUT3n","Size":"4195305"}
* Connection #0 to host localhost left inta
```

3. Create another file that is 10MB:
```
dd if=/dev/urandom of=file.txt count=10 bs=1M
```

4. Try to upload again:
```
curl -v -F 'file=@file.txt' 'http://localhost:8888/api/v0/add?progress=true'
...(omitted)...
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
...(omitted)...
{"Name":"file.txt","Bytes":262144}
...(omitted)...
{"Name":"file.txt","Bytes":7077888}
```
And then it just stops, indefinitely.

If the `progress=true` option is omitted everything works just fine.

#### Details

Naturally the upload works just fine without the proxy. I've tried watching the traffic with `tcpdump` to figure out who stops responding and it seems to be the IPFS service. The nginx proxy passes a chunk of data, and then IPFS doesn't respond, and everything stops.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.