为什么我的 rails 站点收到不包含任何跨域请求的 OPTIONS 请求错误?
Why do I receive an OPTIONS request error for my rails site that doesn't contain any cross-domain requests?
我的 Rails 应用程序,关闭和打开,遇到致命错误:
ActionController::RoutingError (No route matches [OPTIONS] "/"):
经过一些谷歌搜索,我发现这与跨域请求和使用 CORS 在域之间进行通信有关。不过,该应用程序没有内置任何此类请求。此错误是否意味着有人试图从另一个域联系我的域根目录?还是我遗漏了一些明显的东西?
完整错误:
F, [2016-09-29T21:38:56.500387 #28585] FATAL -- :
ActionController::RoutingError (No route matches [OPTIONS] "/"):
actionpack (4.2.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.2.5.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.5.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.5.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.5.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
actionpack (4.2.5.1) lib/action_dispatch/middleware/ssl.rb:24:in `call'
railties (4.2.5.1) lib/rails/engine.rb:518:in `call'
railties (4.2.5.1) lib/rails/application.rb:165:in `call'
passenger (4.0.60) lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
passenger (4.0.60) lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
passenger (4.0.60) lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
passenger (4.0.60) lib/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'
事实证明,服务器 cpu 刚刚超载,我们升级到更大的服务器。我们的新理论是,当 cpu 过载时,负载平衡器正在服务器之间交换用户,这似乎是一个跨域请求。不管事实是否如此,问题都消失了。
我的 Rails 应用程序,关闭和打开,遇到致命错误:
ActionController::RoutingError (No route matches [OPTIONS] "/"):
经过一些谷歌搜索,我发现这与跨域请求和使用 CORS 在域之间进行通信有关。不过,该应用程序没有内置任何此类请求。此错误是否意味着有人试图从另一个域联系我的域根目录?还是我遗漏了一些明显的东西?
完整错误:
F, [2016-09-29T21:38:56.500387 #28585] FATAL -- :
ActionController::RoutingError (No route matches [OPTIONS] "/"):
actionpack (4.2.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.2.5.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.5.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.5.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.5.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
actionpack (4.2.5.1) lib/action_dispatch/middleware/ssl.rb:24:in `call'
railties (4.2.5.1) lib/rails/engine.rb:518:in `call'
railties (4.2.5.1) lib/rails/application.rb:165:in `call'
passenger (4.0.60) lib/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
passenger (4.0.60) lib/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
passenger (4.0.60) lib/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
passenger (4.0.60) lib/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'
事实证明,服务器 cpu 刚刚超载,我们升级到更大的服务器。我们的新理论是,当 cpu 过载时,负载平衡器正在服务器之间交换用户,这似乎是一个跨域请求。不管事实是否如此,问题都消失了。