【问题标题】:Production Rails App - Strange redirect to external sites生产 Rails 应用程序 - 奇怪的重定向到外部站点
【发布时间】:2012-08-10 04:59:06
【问题描述】:

我刚刚将我的第一个 Rails 3.2.6 应用程序启动到生产服务器。当有人访问主页时,这由我的 IndexController 处理,根据登录用户的类型,它可能会将其发送到另一个 URL。

我所拥有的稍微简化的代码示例如下:

def index
  path = new_user_session_url    #default path
  if current_user
    path = users_admin_index_path    #admin path
  end
  redirect_to path, :notice => flash[:notice], :alert => flash[:alert]
end

我感到困惑的是,我一直在监视日志中的问题,并且似乎重定向将针对两个 IP 地址转到巴西的随机站点。这是我应该担心的事情吗?任何有关帮助我了解这里发生的事情的信息将不胜感激。

请参阅下面的日志摘录,在“重定向到”URL 中,域正在从我的站点更改为 www.bradesco.com.br、www.bb.com.br 或 www.itau.com。 br.

没有人报告网站上的任何问题,但我只是想尝试更好地理解这一点。

日志提取

Started GET "/" for 65.111.177.188 at 2012-08-10 00:20:10 -0400
Processing by Home::IndexController#index as HTML
Redirected to http://www.itau.com.br/home
Completed 302 Found in 2ms (ActiveRecord: 0.0ms)

Started GET "/" for 65.111.177.188 at 2012-08-10 00:20:10 -0400
Processing by Home::IndexController#index as HTML
Redirected to http://www.bradesco.com.br/home
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)

Started GET "/" for 65.111.177.188 at 2012-08-10 00:20:10 -0400
Processing by Home::IndexController#index as HTML
Redirected to http://www.bb.com.br/home
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)

Started GET "/" for 64.251.28.71 at 2012-08-09 22:00:20 -0400
Processing by Home::IndexController#index as HTML
Redirected to http://www.bradesco.com.br/home
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)

【问题讨论】:

    标签: ruby-on-rails-3 redirect production-environment


    【解决方案1】:

    我在我的一台 Rails 登台服务器上看到了同样的情况。我认为问题在于您需要拒绝所有不属于预期域的流量。

    在你的 nginx 设置中有这样的东西(如果你使用的是 nginx):

    http://nginx.org/en/docs/http/server_names.html

    server {
        listen       80  default_server;
        server_name  _;
        return       444;
    }
    

    不确定此流量的意义何在?使用其他人的 Rails 应用程序作为网络钓鱼站点的某种迂回新方法,同时嗅探网络流量?这似乎有太多变数,无法成为一种有效的技术。

    【讨论】:

    • 谢谢,我正在使用Passenger,但我会看看如何为我的应用程序执行此操作并在本周末对其进行测试。我会告诉你我怎么走的。
    猜你喜欢
    • 2017-06-17
    • 1970-01-01
    • 2016-03-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多