【问题标题】:Restrict access to static resource on nginx behind alteon限制对 alteon 后面 nginx 上静态资源的访问
【发布时间】:2019-10-14 13:19:17
【问题描述】:

我在 Alteon 负载均衡器后面有两个资源 /public_url/private_url 的 nginx。我可以使用nginx.conf 限制对private_url 的访问:

location /private_url {
  include whitelist.conf; 
  deny all;
}

请注意,public_url 仍可通过任何 IP 地址访问

这在我直接访问 nginx 时有效。但是,当我通过 Alteon 访问 nginx 时,我只能看到 Alteon 的 IP 地址。结果,我无法区分列入白名单和列入黑名单的 IP 地址。

将 IP 过滤组织到private_url 的正确方法是什么,但在 nginx 落后于 alteon 时向所有人提供public_url

【问题讨论】:

    标签: nginx load-balancing whitelist


    【解决方案1】:

    默认情况下,负载均衡器在将请求传递到上游时会删除所有客户端的标头。包括 ip 地址并将其替换为服务器的 ip。
    在 nginx 作为负载均衡器中,您将添加proxy_set_header X-Real-IP $remote_addr;。我不确定 Alteon,但我发现这个链接解释了如何实现这一点:https://support.radware.com/app/answers/answer_view/a_id/15085/~/how-to-insert-x-forwarded-header-for-piped-server-load-balanced-traffic-to-real

    【讨论】:

      猜你喜欢
      • 2012-02-10
      • 2013-08-28
      • 2012-04-06
      • 2018-06-17
      • 2011-10-14
      • 2016-04-22
      • 1970-01-01
      • 2012-11-05
      • 2011-05-03
      相关资源
      最近更新 更多