前提
项目的gateway端口为10080,因为之前使用的一直是低版本的Chrome,所以没有出现问题。前几天部署了一套新的环境,使用我笔记本的最新的Chrome访问,前端的接口(host:10080)一致过不去,排查了nginx、firewall等都是没问题的。后来搜索相关问题,看到有篇文章提了一句,Chrome有一些保留端口,是不让使用的。所以去查询了下,果然,Chrome是有这样的一些端口的,(blocked ports),并且在2021-4-13
加上了10080。
端口文件:
https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/net/base/port_util.cc
端口列表:
// The general list of blocked ports. Will be blocked unless a specific
// protocol overrides it. (Ex: ftp can use port 21)
// When adding a port to the list, consider also adding it to kAllowablePorts,
// below.
const int kRestrictedPorts[] = {
1, // tcpmux
7, // echo
9, // discard
11, // systat
13, // daytime
15, // netstat
17, // qotd
19, // chargen
20, // ftp data
21, // ftp access
22, // ssh
23, // telnet
25, // smtp
37, // time
42, // name
43, // nicname
53, // domain
69, // tftp
77, // priv-rjs
79, // finger
87, // ttylink
95, // supdup
101, // hostriame
102, // iso-tsap
103, // gppitnp
104, // acr-nema
109, // pop2
110, // pop3
111, // sunrpc
113, // auth
115, // sftp
117, // uucp-path
119, // nntp
123, // NTP
135, // loc-srv /epmap
137, // netbios
139, // netbios
143, // imap2
161, // snmp
179, // BGP
389, // ldap
427, // SLP (Also used by Apple Filing Protocol)
465, // smtp+ssl
512, // print / exec
513, // login
514, // shell
515, // printer
526, // tempo
530, // courier
531, // chat
532, // netnews
540, // uucp
548, // AFP (Apple Filing Protocol)
554, // rtsp
556, // remotefs
563, // nntp+ssl
587, // smtp (rfc6409)
601, // syslog-conn (rfc3195)
636, // ldap+ssl
989, // ftps-data
990, // ftps
993, // ldap+ssl
995, // pop3+ssl
1719, // h323gatestat
1720, // h323hostcall
1723, // pptp
2049, // nfs
3659, // apple-sasl / PasswordServer
4045, // lockd
5060, // sip
5061, // sips
6000, // X11
6566, // sane-port
6665, // Alternate IRC [Apple addition]
6666, // Alternate IRC [Apple addition]
6667, // Standard IRC [Apple addition]
6668, // Alternate IRC [Apple addition]
6669, // Alternate IRC [Apple addition]
6697, // IRC + TLS
10080, // Amanda
};
解决方法:
1、从实际情况出发,还是不使用这些端口,避开为好。
- 本来想找到可以查看当前chrome的blocked ports的方法,但是找了一圈,没找到,还是避开这些端口吧
2、
- 右键Chrome—>属性---->目标
- -添加:
--explicitly-allowed-ports=xxx
- 例如:C:\Program Files\Google\Chrome\Application\chrome.exe --explicitly-allowed-ports=10080