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

Incorrect port request

Open Maasea opened this issue 4 years ago • 2 comments

Steps to reproduce

open element-ios and you will capture the wrong port request.

What happened?

I let my homeserver listen 8443 port, and use https://mydomain:8443 to login, but element ios often request https://mydomain:443/.well-known/matrix/client to get info, which is a mistake port.

image

Your phone model

IPHONE12

Operating system version

IOS14

Application version

Testflight 1.6

Homeserver

No response

Have you submitted a rageshake?

No

Maasea avatar Sep 25 '21 01:09 Maasea

@Maasea Could you provide more information about when you see this happening? It is behaving as we would expect from what I understand. As discussed in the spec the well-known request is made to the https://serverdomain/ to inform the client of where to find the homeserver. It isn't an issue if doesn't find anything, but if it does it will use this information to discover your actual server URL.

pixlwave avatar Jul 25 '22 15:07 pixlwave

I log in to the element-ios using a custom server, and the server address is https://mydomain:8443.

Notably, I use port 8443 rather than the typical 443 port since 443 is already in use by another application.

I aspect element-ios request https://mydomain:8443/.well-known/matrix/client to get info instead of https://mydomain:443/.well-known/matrix/client

Because the packet capture software does not display the normal port, port 443 is not visible in the image above. So the screenshot shows a failed request for https://mydomain/.well-known/matrix/client.

Here is a simplified configuration of nginx:

server {     
    listen 8443 ssl http2;
    listen [::]:8443 ssl http2;
    # for federation port
    listen 8448 ssl http2 default_server;
    listen [::]:8448 ssl http2 default_server;

    ssl_certificate /home/ubuntu/ssl/xxx.crt;
    ssl_certificate_key /home/ubuntu/ssl/xxx.key;
    
    location ~* ^(\/_matrix|\/_synapse\/client) {
        proxy_pass http://localhost:8008;
        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;
    }
    location /.well-known/matrix/client {
   	 return 200 '{"m.homeserver": {"base_url": "https://mydomain.com:8443"}}';
   	 default_type application/json;
   	 add_header Access-Control-Allow-Origin *;
	}
}

Maasea avatar Jul 25 '22 15:07 Maasea