Rocket.Chat.ReactNative
Rocket.Chat.ReactNative copied to clipboard
Upload fails whenever I upload files via the app
Description:
I currently run RocketChat on a docker container. The docker container is also exposed via reverse proxy (rocketchat.mydomain.com)
Whenever I try and upload a file via the app, I get an error message (Try again).
The log shows this:
2021/06/01 09:06:47 [error] 2393#2393: *64978 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.1, server: chat.*, request: "GET /websocket HTTP/1.1", upstream: "http://192.168.x.x:xxxx/websocket", host: "rocketchat.xxxxxxxxxxxxx.com"
2021/06/01 09:06:50 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr HTTP/2.0", upstream: "http://192.168.x.x:xxxx/api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr", host:
2021/06/01 09:06:50 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /sockjs/info?cb=h69ka5nlbs HTTP/2.0", upstream: "http://192.168.x.x:xxxx/sockjs/info?cb=h69ka5nlbs", host: "rocketchat.xxxxxxxxxxxxx.com", referrer: "https://rocketchat.xxxxxxxxxxxxx.com/admin/
2021/06/01 09:06:51 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr HTTP/2.0", upstream: "http://192.168.x.x:xxxx/api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr", host:
2021/06/01 09:06:53 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr HTTP/2.0", upstream: "http://192.168.x.x:xxxx/api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr", host:
2021/06/01 09:06:54 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /sockjs/info?cb=cpwj76x9dd HTTP/2.0", upstream: "http://192.168.x.x:xxxx/sockjs/info?cb=cpwj76x9dd", host: "rocketchat.xxxxxxxxxxxxx.com", referrer: "https://rocketchat.xxxxxxxxxxxxx.com/admin/
2021/06/01 09:06:55 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr HTTP/2.0", upstream: "http://192.168.x.x:xxxx/api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr", host:
2021/06/01 09:06:59 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr HTTP/2.0", upstream: "http://192.168.x.x:xxxx/api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr", host:
2021/06/01 09:07:02 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /sockjs/info?cb=6gdte1qz6w HTTP/2.0", upstream: "http://192.168.x.x:xxxx/sockjs/info?cb=6gdte1qz6w", host: "rocketchat.xxxxxxxxxxxxx.com", referrer: "https://rocketchat.xxxxxxxxxxxxx.com/admin/
2021/06/01 09:07:07 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr HTTP/2.0", upstream: "http://192.168.x.x:xxxx/api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr", host:
2021/06/01 09:07:19 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /sockjs/info?cb=gw2ooltrnv HTTP/2.0", upstream: "http://192.168.x.x:xxxx/sockjs/info?cb=gw2ooltrnv", host: "rocketchat.xxxxxxxxxxxxx.com", referrer: "https://rocketchat.xxxxxxxxxxxxx.com/admin/
2021/06/01 09:07:24 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr HTTP/2.0", upstream: "http://192.168.x.x:xxxx/api/v1/users.presence?ids[]=rocket.cat&ids[]=aEtjPeYdpK2sMNYBr", host:
2021/06/01 09:07:43 [error] 2393#2393: *64953 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.19.0.1, server: chat.*, request: "GET /sockjs/info?cb=wfh5jecjm0 HTTP/2.0", upstream: "http://192.168.x.x:xxxx/sockjs/info?cb=wfh5jecjm0", host: "rocketchat.xxxxxxxxxxxxx.com", referrer: "https://rocketchat.xxxxxxxxxxxxx.com/admin/
2021/06/01 09:10:03 [crit] 2393#2393: *65120 open() "/var/lib/nginx/tmp/client_body/0000000024" failed (13: Permission denied), client: 172.19.0.1, server: chat.*, request: "POST /api/v1/rooms.upload/GENERAL HTTP/2.0", host: "rocketchat.xxxxxxxxxxxxx.com"
The issue does NOT occur if I try and upload from my pc via browser
Environment Information:
- Rocket.Chat Server Version: 3.15.0
- Rocket.Chat App Version: 4.17.0.24177
- Device Name: Sony Xperia 1 II
- OS Version: Android 10
Additional context:
This is my nginx config
# Upstream definition
upstream backend {
server 192.168.x.x:xxxx;
}
# http to https redirection
server {
listen 80;
server_name rocketchat.xxxxxxxxxxxxxxxxxxx.com;
rewrite ^ https://$server_name$request_uri? permanent;
client_max_body_size 512M;
}
# HTTPS Server
server {
listen 443;
server_name chat.*;
error_log /var/log/nginx/rocket-chat.access.log;
ssl on;
include /config/nginx/ssl.conf;
client_max_body_size 512M;
location / {
proxy_pass http://192.168.1.200:3030;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}
Hi,
I think the likely answer here is your nginx config.
Have a look at this one as a guide that I took from the repos and checked it worked on my own install.
https://gist.github.com/johncrisp/fc3706cb8d5b2aafb24e84e2e63770f8
Try disabling http:80 and just use https:443 for starters.
Also check the section here on websockets just in case.
https://gist.github.com/reetp/a66149d5f060f260643a353ca7067a98
Does this happen on a desktop?
@AlexKalopsia
You have copied your nginx configuration from an erroneous source of the installation documentation.
Correct header names are:
X-Forwarded-For
X-Forwarded-Proto