matrix-org / sliding-sync

Proxy implementation of MSC3575's sync protocol.
https://github.com/matrix-org/matrix-spec-proposals/pull/3575
Apache License 2.0
249 stars 36 forks source link

Cannot contact upstream server #460

Closed sliwik closed 1 month ago

sliwik commented 1 month ago

Hi, I had to reconfigure sliding-sync environment after my NAS crashed. For a reason I cannot understand, my sliding-sync configuration is not working and I get this message in my log:

WRN Could not contact upstream homeserver. Is SYNCV3_SERVER set correctly? error="Get \"https://matrix-DOMAIN.com/_matrix/client/versions\": dial tcp: lookup matrix-DOMAIN.com on 127.0.0.11:53: read udp 127.0.0.1:52563->127.0.0.11:53: i/o timeout" dest=https://matrix-DOMAIN.com

My docker-compose is the same than before the crash with SYNCV3_SERVER=https://matrix-DOMAIN.com.

Any idea ? Should I add anything in my NGINX configuration to allow response to https://matrix-DOMAIN.com/_matrix/client/versions? It currently returns:

{ "versions": [ "r0.0.1", "r0.1.0", "r0.2.0", "r0.3.0", "r0.4.0", "r0.5.0", "r0.6.0", "r0.6.1", "v1.1", "v1.2", "v1.3", "v1.4", "v1.5", "v1.6", "v1.7", "v1.8", "v1.9", "v1.10" ], "unstable_features": { "org.matrix.label_based_filtering": true, "org.matrix.e2e_cross_signing": true, "org.matrix.msc2432": true, "uk.half-shot.msc2666.query_mutual_rooms": true, "io.element.e2ee_forced.public": false, "io.element.e2ee_forced.private": false, "io.element.e2ee_forced.trusted_private": false, "org.matrix.msc3026.busy_presence": false, "org.matrix.msc2285.stable": true, "org.matrix.msc3827.stable": true, "org.matrix.msc3440.stable": true, "org.matrix.msc3771": true, "org.matrix.msc3773": false, "fi.mau.msc2815": false, "fi.mau.msc2659.stable": true, "org.matrix.msc3882": false, "org.matrix.msc3881": false, "org.matrix.msc3874": false, "org.matrix.msc3886": false, "org.matrix.msc3912": false, "org.matrix.msc3981": true, "org.matrix.msc3391": false, "org.matrix.msc4069": false, "org.matrix.msc4028": false, "org.matrix.msc4108": false } }

Thank you for your help.

sliwik commented 1 month ago

And to be precise, heree is my NGINX conf:

server {
  listen 443 ssl;
  listen [::]:443 ssl;

  server_name matrix-DOMAIN.com;

  ssl_certificate fullchain.pem;
  ssl_certificate_key privkey.pem;

  location ~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/sync) {
    proxy_pass http://localhost:28009;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $host;
    }

  location ~ ^(\/_matrix|\/_synapse\/client) {
    proxy_connect_timeout 60;
    proxy_read_timeout 60;
    proxy_send_timeout 60;
    proxy_intercept_errors off;
    proxy_http_version 1.1;
    proxy_set_header        Host            $http_host;
    proxy_set_header        X-Real-IP            $remote_addr;
    proxy_set_header        X-Forwarded-For            $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto            $scheme;
    proxy_pass http://localhost:28008;
    }

  location /.well-known/matrix/server {
    default_type application/json;
    return 200 '{ "m.server": "matrix-DOMAIN.com:443" }';
    add_header Access-Control-Allow-Origin *;
    }

  location /.well-known/matrix/client {
    return 200 '{"m.homeserver": {"base_url": "https://matrix-DOMAIN.com"},"org.matrix.msc3575.proxy": {"url": "https://matrix-DOMAIN.com"}}';
    default_type application/json;
    add_header Access-Control-Allow-Origin *;
    }
sliwik commented 1 month ago

I found out I had Firewall rules that prevent Container to communicate.