ruby-on-rails - 为什么 Passenger/mod_rails 文档要求我显式禁用多 View ?

标签 ruby-on-rails apache passenger multiview

来自documentation :

<VirtualHost *:80>
    ServerName www.mycook.com
    DocumentRoot /webapps/mycook/public
    <Directory /webapps/mycook/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

那么为什么是下面这行呢?

Options -MultiViews

我粗略地理解,how MultiViews有效,坦率地说,我不明白为什么有人会使用它。尽管如此,我不明白为什么 Passenger 配置指南认为在站点配置中显式禁用该选项如此重要。

谁能透露一下情况吗?

最佳答案

我不熟悉 Rails,但一般来说,启用 MultiViews 在某些情况下可能会导致有趣的行为 - 最常见的是,当输入不正确的 URL 时,它最终可能会提供页面,而不是返回 404 .

Here是一篇关于多 View 另一个微妙的可能问题的博客文章。

This GoDaddy 博客文章指出了另一个有问题的后果:

Script files are of particular concern. Say you have an old version of a script.pl file that you copy to script.pl.bak for backup purposes. A request for script.pl.bak will still be interpreted by Apache as a Perl script, causing the old version of your code to be executed! One can imagine other instances where a script file may be executed unintentionally because of this behavior by Apache.

底线,多 View 对于静态 HTML 页面的集合来说很好,但在重写 URL 的环境中并不是一件好事。

关于ruby-on-rails - 为什么 Passenger/mod_rails 文档要求我显式禁用多 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4774547/

相关文章:

Apache 服务突然宕机

c - Apache 模块创建教程包含有错误的代码。怎么修?

java - 使用 `Replace()` 方法不会替换 Apache POI 中的文本

ruby-on-rails - Sucker Punch Job 被 Passenger 杀死?还是死锁?

ruby-on-rails - 无法通过Passenger/Nginx 强制Rails 进入生产环境

javascript - rails : onchange posting not sending param

mysql - 带有时区的 ActiveRecord 未按预期工作

ruby-on-rails - 门卫 gem 从 5.1.0 升级到 5.2.1 后缺少必需参数 : scope.

ruby-on-rails - 由于此错误 : Option 'agents_dir' missing in file - Rails 4 + Passenger deployment,无法初始化乘客

ruby-on-rails - 本地化时间单位