
<!--<remote_url_allow_hosts>--><!-- Host should be specified exactly as in URL. The name is checked before DNS resolution.Example: "yandex.ru", "yandex.ru." and "www.yandex.ru" are different hosts.If port is explicitly specified in URL, the host:port is checked as a whole.If host specified here without port, any port with this host allowed."yandex.ru" -> "yandex.ru:443", "yandex.ru:80" etc. is allowed, but "yandex.ru:80" -> only "yandex.ru:80" is allowed.If the host is specified as IP address, it is checked as specified in URL. Example: "[2a02:6b8:a::a]".If there are redirects and support for redirects is enabled, every redirect (the Location field) is checked.Host should be specified using the host xml tag:<host>yandex.ru</host>--><!-- Regular expression can be specified. RE2 engine is used for regexps.Regexps are not aligned: don't forget to add ^ and $. Also don't forget to escape dot (.) metacharacter(forgetting to do so is a common source of error).--><!--</remote_url_allow_hosts>-->
<remote_url_allow_hosts><host>yandex.ru</host></remote_url_allow_hosts>
这意味着:
yandex.ru:80 是允许的。
yandex.ru:443 是允许的。
yandex.ru:8080 是允许的。
2. URL带端口号
如果配置中指定了主机名和端口号,例如 yandex.ru:80 则只允许访问该主机的指定端口
<remote_url_allow_hosts><host>yandex.ru:80</host></remote_url_allow_hosts>
这意味着:
yandex.ru:80 是允许的。
yandex.ru:443 是不允许的。
yandex.ru:8080 是不允许的。
3、使用IP和端口号
使用 IP 地址,规则与主机名相同。
<remote_url_allow_hosts><host>192.168.1.1</host> <!-- 允许 192.168.1.1 的所有端口 --><host>192.168.2.1:8080</host> <!-- 只允许 192.168.2.1:8080 --></remote_url_allow_hosts>
IPv6 地址,需要用方括号 [ ] 包裹地址。
<remote_url_allow_hosts><host>[2001:db8::1]</host> <!-- 允许 [2001:db8::1] 的所有端口 --><host>[2001:db8::1]:8080</host> <!-- 只允许 [2001:db8::1]:8080 --></remote_url_allow_hosts>

文章转载自运维笔谈,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




