The download link was working OK.
When I added a nginx layer, it’s not working properly. Most of the times, it only returned partial files. The connection was closed before the file is downloaded.
nginx.1 | 2018/04/26 21:45:39 [alert] 41#41: *550 recv() failed (14: Bad address) while reading upstream, client: 125.168.222.225, server: www.dengnz.com, request: “GET /wp-content/download.php?name=link2sd HTTP/2.0”, upstream: “http:/
/172.17.0.5:80/wp-content/download.php?name=link2sd“, host: “www.dengnz.com“, referrer: “https://www.dengnz.com/youtube/“
I then tried to use curl and wget in another docker to access the wordpress container. I can reproduce the issue, so that there is nothing to do with nginx.
Both Curl and Wget gave “bad address” error as well.
root@fa624a62a561:/# curl -O http://172.18.0.2/wp-content/shareMyFileSecretly/link2sd.apk
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
26 3792k 26 1015k 0 0 9846k 0 –:–:– –:–:– –:–:– 9956k
curl: (56) Recv failure: Bad address
k2sd.apk24a62a561:/# wget http://172.17.0.5:80/wp-content/download3.php?name=lin
–2018-04-27 00:52:42– http://172.17.0.5/wp-content/download3.php?name=link2sd.apk
Connecting to 172.17.0.5:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 3883503 (3.7M) [application/vnd.android.package-archive]
Saving to: ‘download3.php?name=link2sd.apk.2’
download3.php?name= 27%[====> ] 1.00M –.-KB/s in 0.1s
2018-04-27 00:52:42 (6.69 MB/s) – Read error at byte 1051536/3883503 (Bad address). Retrying.
Then I tried to use wget and curl from the host VM to access the wordpress container, same issue.
Both curl and wget didn’t give “bad address” any more.
Wget gave connection closed:
root@fengUbuntu:~/certs# wget http://localhost:8082/wp-content/shareMyFileSecretly/link2sd.apk
–2018-04-27 14:58:02– http://localhost:8082/wp-content/shareMyFileSecretly/link2sd.apk
Resolving localhost (localhost)… 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 3883503 (3.7M) [application/vnd.android.package-archive]
Saving to: ‘link2sd.apk.3’
link2sd.apk.3 27%[====================================> ] 1.02M –.-KB/s in 0.03s
2018-04-27 14:56:56 (33.1 MB/s) – Connection closed at byte 1066270. Retrying.
Curl gave transfer closed:
root@fengUbuntu:~/certs# wget http://localhost:8082/wp-content/shareMyFileSecretly/link2sd.apk
–2018-04-27 14:58:02– http://localhost:8082/wp-content/shareMyFileSecretly/link2sd.apk
Resolving localhost (localhost)… 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 3883503 (3.7M) [application/vnd.android.package-archive]
Saving to: ‘link2sd.apk.3’
link2sd.apk.3 27%[====================================> ] 1.02M –.-KB/s in 0.03s
2018-04-27 14:56:56 (33.1 MB/s) – Connection closed at byte 1066270. Retrying.
Which may mean that, the Apache server of wordpress container close the connection for some reason. When the communication was between two docker containers, it gave “bad address” error, because (maybe) sockets are used between to containers.
But why there is no problem when access from public?
Because accessing from public has a slower speed? No, I limited the speed to 100K, it’s still happening.
I then tried to host the file using python’s simple http server, it work well. So there nothing to do with the loop back interface.
It could be something with the docker0 interface? I don’t know.
Further investigation is needed.