【问题标题】:Enable DELETE method with nginx, passenger and Rails使用 nginx、passenger 和 Rails 启用 DELETE 方法
【发布时间】:2015-03-13 16:30:23
【问题描述】:

我尝试使用乘客和 Nginx 部署 Rails 应用程序。 一切正常,但是当我想发送 DELETE 请求时,例如:

<%= link_to "Sign out", sign_out_path, method: :delete %>

在开发中它工作正常,但在使用 nginx 的生产中,它正在执行 GET 请求。所以逻辑上我得到了这个错误:

ActionController::RoutingError (No route matches [GET] "/sign_out")

我读到nginx需要用http_dav_module编译才能使用DELETE方法。

我做到了,并在 nginx 配置文件中添加了模块,如下所示:

server {
  listen       8080;

  server_name  framework1.local.42.fr;
  passenger_enabled   on;

  location / {

    root          /rails/Framework00/public
    dav_methods   PUT DELETE;
    dav_access    group:rw  all:r;
  }

但我得到了同样的结果,DELETE 方法不起作用。

知道如何解决这个问题吗?

【问题讨论】:

    标签: ruby-on-rails nginx passenger


    【解决方案1】:

    这是因为您在生产中遇到 js 错误。应该发送 DELETE 请求的 JavaScript 不起作用。

    【讨论】:

      猜你喜欢
      • 2013-12-23
      • 1970-01-01
      • 1970-01-01
      • 2015-01-16
      • 2019-04-12
      • 2014-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多