element-web icon indicating copy to clipboard operation
element-web copied to clipboard

media requests on web return 404

Open NeiroNz opened this issue 8 months ago • 6 comments

Steps to reproduce

all thumbnail requests /_matrix/media/v3/thumbnail/* return 404 code in web version(avatars do not shows) But in App for Windows and Android - it shows.

Matrix Synapse in docker+nginx on host

and download has same effect

It is no browser depended... Some has wrong in configuration, but what? I full reconfigure nginx and Synapse to postgres. Element-Web is symlink in root /var/www/html. Certificates a self-signed.

server {
        server_name nxn_svc.ru;

        listen 80;
        listen [::]:80;

        return 301 https://$host$request_uri;
}

server {
        server_name nxn-svc.ru;

        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        listen 8448 ssl;
        listen [::]:8448 ssl;

        ssl_certificate /etc/ssl/certs/nxn-svc.crt;
        ssl_certificate_key /etc/ssl/private/nxn-svc.key;

        ssl_protocols TLSv1.2 TLSv1.3;

        index index.html;

        location / {
            root /var/www/html;
        }
        location /.well-known/matrix/server {
            add_header Content-Type application/json;
            return 200 '{"m.server":"nxn-svc.ru:443"}';
        }
        location /.well-known/matrix/client {
            add_header Content-Type application/json;
            return 200 '{"m.homeserver":{"base_url":"https://nxn-svc.ru"}}';
        }
        location ~ ^(/_matrix|/_synapse/client|/_synapse/admin) {
            proxy_pass http://localhost:8008;
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Host $host;
            client_max_body_size 50M;
        }
}

Log line for work client with 200 code:

2026-03-15 06:03:43,992 - synapse.access.http.8008 - 641 - INFO - GET-1852 - ::ffff:192.168.1.21 - 8008 - {@neiron:nxn-svc.ru} Processed request: 0.034sec/-0.000sec (0.012sec, 0.003sec) (0.003sec/0.012sec/2) 1104B 200 "GET /_matrix/client/v1/media/thumbnail/nxn-svc.ru/VrtTOyNrsbaNzJXYzBsxdfsy?width=14&height=14&method=crop&allow_redirect=true HTTP/1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Element/1.12.12 Chrome/144.0.7559.173 Electron/40.4.1 Safari/537.36" [0 dbevts]

Log line for Web with 404 code:

2026-03-15 06:06:56,722 - synapse.access.http.8008 - 641 - INFO - GET-1966 - 192.168.1.21 - 8008 - {None} Processed request: 0.028sec/0.006sec (0.008sec, 0.002sec) (0.002sec/0.009sec/1) 45B 404 "GET /_matrix/media/v3/thumbnail/nxn-svc.ru/VrtTOyNrsbaNzJXYzBsxdfsy?width=32&height=32&method=crop&allow_redirect=true HTTP/1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 YaBrowser/26.3.0.0 Safari/537.36" [0 dbevts]

Request uses different path. And Auth lose in forwarder...

How make it work?

NeiroNz avatar Mar 14 '26 20:03 NeiroNz

Image

NeiroNz avatar Mar 14 '26 20:03 NeiroNz

Clearing the cache fixed this issue for me: Security & Confidentiality -> Help & About, go to bottom of the page and hit Clear cache and reload

tripougnif avatar Mar 14 '26 21:03 tripougnif

It still a not working properly... just a text chat, no files, no images.

I think some problem wit reverse proxy or certificate. Because in clients i am use not proxied version.

NeiroNz avatar Mar 15 '26 06:03 NeiroNz

👋, It's hard to do anything here without more information about your browser. This most likely has something to do with the service worker in your browser failing. Also would be nice to have logs.

MidhunSureshR avatar Mar 19 '26 09:03 MidhunSureshR

Service worker do not start because it blocked selfsigned cert...

Error registering/updating service worker: SecurityError: Failed to register a ServiceWorker for scope ('https://nxn-svc.ru/element/') with script ('https://nxn-svc.ru/element/sw.js'): An SSL certificate error occurred when fetching the script.

NeiroNz avatar Mar 22 '26 14:03 NeiroNz

Then this is an issue caused by your browser/self signed cert. You might be able to tweak a configuration in your browser to accept self signed certificates https://stackoverflow.com/questions/38728176/can-you-use-a-service-worker-with-a-self-signed-certificate but ultimately Element Web requires service workers.

t3chguy avatar Mar 23 '26 08:03 t3chguy