gpt4 book ai didi

ruby-on-rails - 来自 Rails 应用程序的神秘 GET 请求

转载 作者:行者123 更新时间:2023-12-04 05:55:51 25 4
gpt4 key购买 nike

当我为 Rails 应用程序运行服务器时,我看到了一件奇怪的事情。这是日志:

Jatins-MacBook-Pro: silverSpoon$ rails s
=> Booting Thin
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.5.0 codename Knife)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop


Started GET "/app/update-progress" for 127.0.0.1 at 2013-05-19 15:04:56 +0530
Connecting to database specified by database.yml

ActionController::RoutingError (No route matches [GET] "/app/update-progress"):
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.5.0) lib/thin/connection.rb:81:in `block in pre_process'
thin (1.5.0) lib/thin/connection.rb:79:in `catch'
thin (1.5.0) lib/thin/connection.rb:79:in `pre_process'
thin (1.5.0) lib/thin/connection.rb:54:in `process'
thin (1.5.0) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.1) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.1) lib/eventmachine.rb:187:in `run'
thin (1.5.0) lib/thin/backends/base.rb:63:in `start'
thin (1.5.0) lib/thin/server.rb:159:in `start'
rack (1.4.1) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.1) lib/rack/server.rb:265:in `start'
railties (3.2.8) lib/rails/commands/server.rb:70:in `start'
railties (3.2.8) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.8) lib/rails/commands.rb:50:in `tap'
railties (3.2.8) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'

Rendered /Users/silverSpoon/.rvm/gems/ruby-1.9.3-p194@fbTracker/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.3ms)

并且,然后重复地提出请求。请指导我找到这种行为的原因以及如何解决这个问题。
rake:routes的输出是:
bash-3.2$ rake routes
trackers /trackers(.:format) tracker#index
root / home#index
users POST /users(.:format) users#create
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
/auth/:provider/callback(.:format) sessions#create
auth_failure /auth/failure(.:format) :controller#:action
signout /signout(.:format) sessions#destroy
/online/:id(.:format) users#function

如果您需要更多信息,请告诉我。

最佳答案

您的应用没有通往 /app/update_progress 的路径.所以它是以下之一,它在您的应用程序中调用它:

  • 您的应用程序中的 Javascript 代码(您是否有机会使用 this Bootstrap Progressbar?)
    要测试这是否是问题的根源 - 打开 Chrome 开发者工具并转到 Network panel .现在打开您的应用程序 localhost:3000 .如果您在此网络选项卡中看到对 localhost:3000/app/update_progress 的一致调用,那么这意味着您的应用程序正在从 Javascript 触发这些请求。现在您需要搜索您的代码库以找出该 javascript 代码的位置。它也可能在您下载的某个 jquery 扩展中。您可以 create a breakpoint in Javascript whenever an Ajax request is made/app/update_progress .
  • chrome/firefox 扩展
    要排除这种情况,请以隐身模式(通常会禁用所有扩展程序)打开 Chrome/Firefox,然后打开您的应用程序。如果您仍然看到点击 /app/update_progress那么很可能它不是导致问题的扩展。
  • 您正在使用的一些外部 gem
    如果上述两个没有实现,则发布您的 Gemfile.xml 文件。
  • 关于ruby-on-rails - 来自 Rails 应用程序的神秘 GET 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16633327/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com