如何阻止访问IPS白名单,排除允许CDN访问的公共路径?
我有一个临时服务器,我想为其添加 IP 白名单。
问题是,登台服务器使用需要访问登台服务器的源服务器。亚马逊的 CloudFront 没有我们可以使用的静态 IP。
任何人对我如何编写类似这样的东西有任何想法。
- 有了@whitelist_ips,他们就可以访问所有内容。
- 否则,除了 /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.
- Given the @whitelist_ips, they access everything.
- Otherwise, everything is blocked except for /assets and anything in the public directory?
Ideas? Assistance? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要检查 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.