Skip to content

Rustdesk does not honor the X-Real-IP header. #594

@guillaumearnx

Description

@guillaumearnx

Describe the bug
On the “devices” tab of RustDesk, I can see the local IP address of my firewall displayed.
I would like to have the public IP address of the client connecting.
The RustDesk ports are open in Port Forwarding directly on the RustDesk machine. However, port 80,443 redirects to my reverse proxy, which NATs to 21114.

PHP gives me the correct address, but RustDesk does not.
Also, 10.1.0.3 is not the IP address of the reverse proxy, but of the firewall.

Image

Describe the environment

  • Install environment: Docker (install script of rustdesk)
  • Version : Welcome to RustDesk Server Pro 1.6.3

How to Reproduce the bug
Steps to reproduce the behavior:

  1. Log in into web interface
  2. Go into "Devices"
  3. See local IP in "info" column

Expected behavior
Have the public IP of client

Additional context
Reverse proxy conf :

server {
	listen 80;
	server_name XXXX;
	location / {
		return 301 https://$server_name$request_uri;
	}
}

# https
server {
	listen 443 ssl;
	ssl_certificate /etc/letsencrypt/live/XXXX/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/XXXX/privkey.pem;
	server_name XXXX;
	location / {
		proxy_pass http://server:21114;
		proxy_set_header            X-Real-IP          $remote_addr;
		proxy_set_header            X-Forwarded-For    $proxy_add_x_forwarded_for;
	}

	location /ws/id {
        proxy_pass http://server:21118;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $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_read_timeout 120s;
    }

    location /ws/relay {
        proxy_pass http://server:21119;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $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_read_timeout 120s;
    }

	client_max_body_size 200M;
	client_body_buffer_size 100M;
	proxy_max_temp_file_size 0;
	proxy_connect_timeout       600s;
	proxy_send_timeout          600s;
	proxy_read_timeout          600s;
	send_timeout                600s;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions