121.40.205.143 - - [22/Jun/2016:12:56:23 +0800] "GET /wechat/account.html HTTP/1.1" 200 3432 "-" "Mozilla/8.0" --此时地址为haproxy的地址 120.55.118.6 - - [22/Jun/2016:13:07:26 +0800] "GET /wechat/account.html HTTP/1.1" 200 3432 "-" "Mozilla/8.0" 从wx03-120.55.118.6 访问 use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); #$ua->env_proxy('http','http://$ARGV[0]'); $ua->agent("Mozilla/8.0"); my $response = $ua->get('https://uatest.xxx.com/wechat/account.html'); if ($response->is_success) { print $response->decoded_content; # or whatever } else { die $response->status_line; } ~ ~ 此时useragent为Mozilla/8.0 修改脚本: use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); #$ua->env_proxy('http','http://$ARGV[0]'); #$ua->agent("Mozilla/8.0"); my $response = $ua->get('https://uatest.xxx.com/wechat/account.html'); if ($response->is_success) { print $response->decoded_content; # or whatever } else { die $response->status_line; } 121.40.205.143 - - [22/Jun/2016:13:08:54 +0800] "GET /wechat/account.html HTTP/1.1" 200 3432 "-" "libwww-perl/6.15"