将IP隐藏在反向代理后面?

时间:2019-06-23 11:59:09

标签: nginx nginx-reverse-proxy

我在服务器上设置了反向代理。当我键入curl -I -X GET domain.com时,响应将显示真实IP地址。该如何解决?

Output:
HTTP/1.1 301 Moved Permanently
Date: Sun, 23 Jun 2019 11:47:39 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 57
Connection: keep-alive
Set-Cookie: __cfduid=...; expires=Mon, 22-Jun-20 11:47:39 GMT; path=/; domain=.domain.com; HttpOnly
Location: https://therealip:1234;
Vary: Accept, Accept-Encoding
Cache-Control: public, max-age=86400, s-maxage=10
X-Content-Type-Options: nosniff
Server: cloudflare
CF-RAY: ...
...
location / {
 add_header Cache-Control max-age=86400;
 proxy_pass http://therealip:1234;
 proxy_redirect   default;
 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 $http_x_forwarded_proto;
 proxy_max_temp_file_size 0;
}
...

0 个答案:

没有答案