rustdesk / rustdesk/rustdesk-server

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

Open
#594 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
10.4k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

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;
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no source files or tests. Start by tracing how the Devices tab obtains and displays the client IP, then reproduce the behavior through the supplied reverse-proxy configuration with its X-Real-IP header. Done means the web interface shows the public client IP rather than the firewall or proxy address.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.