我们使用 WordPress 插件来检查损坏的链接。它使用 cURL 来做到这一点。外部链接工作正常,但内部链接,不是那么多。连接被拒绝。
与我们的主持人讨论了这个问题,他们说“我们将服务器放在内部专用网络上,然后通过 NAT 连接到互联网。
curl 命令必须直接连接到服务器的私有 IP 地址。”
换句话说,curl people-press.org/about/danielle-gewurz/
需要...
curl -H “主持人:people-press.org” 10.5.1.66/about/danielle-gewurz/
我真的不想弄乱插件来让它与我们不寻常的设置一起工作,所以从网络架构的角度你有什么可以推荐的吗?
我知道我正在寻找的是一种叫做发夹式 NAT 环回 / NAT 内部到内部的东西,看起来像这样...... www.juniper.net/techpubs/en_US/junos11.2/information-products/topic- collections/security/software-all/security/index.html?topic-56995.html
当然,我的主人不知道我在说什么。
我有一个 nginx 服务器坐在负载平衡器后面。负载平衡器处理 SSL 终止,所有请求都在端口 80 上命中 nginx。我还使用SRCache 模块使用 Redis 进行全页缓存。缓存模块使用 URL 作为缓存键,如$schemeGET$host$request_uri
. 我在想我可以$scheme
以某种方式覆盖 nginx 的变量,所以缓存密钥方案将是,https
而不是http
我不确定如何做到这一点,或者甚至可能。
我的应用程序会在各种事件后清除缓存,并使用它生成缓存键,https
但 nginx 正在缓存键中使用http
。这意味着由于缓存键名称不匹配,缓存没有被正确清除。
如果有帮助,这是我的站点配置:
server {
listen 80;
server_name example.com example.org example.net ;
set $redirect_to_https 0;
if ( $http_x_forwarded_proto != 'https' ) {
set $redirect_to_https 1;
}
if ( $request_uri = '/health-check.php' ) {
set $redirect_to_https 0;
}
if ( $redirect_to_https = 1 ) {
return 301 https://$host$request_uri;
}
# …
Run Code Online (Sandbox Code Playgroud)