如何阻止访问IPS白名单,排除允许CDN访问的公共路径?

发布于 2024-12-01 05:35:17 字数 246 浏览 2 评论 0原文

我有一个临时服务器,我想为其添加 IP 白名单。

问题是,登台服务器使用需要访问登台服务器的源服务器。亚马逊的 CloudFront 没有我们可以使用的静态 IP。

任何人对我如何编写类似这样的东西有任何想法。

  1. 有了@whitelist_ips,他们就可以访问所有内容。
  2. 否则,除了 /assets 和公共目录中的任何内容之外,所有内容都会被阻止?

有想法吗?协助?谢谢

I have a staging server that I want to have a whitelist of IPs for.

Problem is, the staging server uses an origin server that needs to hit the staging server. It's Amazon's CloudFront which has no static IPs we can use.

Anyone have any ideas on how I can write something that does something like this.

  1. Given the @whitelist_ips, they access everything.
  2. Otherwise, everything is blocked except for /assets and anything in the public directory?

Ideas? Assistance? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幻梦 2024-12-08 05:35:17

您需要检查 CloudFront 使用发出请求的远程 IP 发送的 X-Forwarded-For 标头,并根据您的白名单进行检查。

这篇文章: http://kev.in/2007/08/26/how-to-obtain-the-ip-address-of-the-current-user.html表明request.remote_ip可能已经检查X-转发-For。

You'll need to check the X-Forwarded-For header which CloudFront sends with the remote IP from where the request originated and check that against your whitelist.

This post: http://kev.in/2007/08/26/how-to-obtain-the-ip-address-of-the-current-user.html suggests that request.remote_ip may already check X-Forwarded-For.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文