为什么 Passenger/mod_rails 文档要求我显式禁用多视图?
来自文档:
<VirtualHost *:80>
ServerName www.mycook.com
DocumentRoot /webapps/mycook/public
<Directory /webapps/mycook/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
那么为什么是下面一行呢?
Options -MultiViews
我粗略地了解 MultiViews 的工作原理,坦率地说,我不知道不明白为什么有人会使用它。尽管如此,我不明白为什么乘客配置指南认为在站点配置中显式禁用该选项如此重要。
谁能透露一下情况吗?
From the documentation:
<VirtualHost *:80>
ServerName www.mycook.com
DocumentRoot /webapps/mycook/public
<Directory /webapps/mycook/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
So why the following line?
Options -MultiViews
I understand, coarsely, how MultiViews works, and frankly, I don't understand why anybody would use it. Nevertheless, I don't see why the Passenger configuration guide sees it as so important to explicitly disable the option in the site configuration.
Can anyone shed light on the situation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉 Rails,但一般来说,启用 MultiViews 在某些情况下可能会导致有趣的行为 - 最常见的是,当输入不正确的 URL 时,它最终可能会提供页面,而不是返回应有的 404。
这里是一篇关于另一个微妙的可能的博客文章多视图问题。
此 GoDaddy 博客条目指出了另一个有问题的后果:
底线是,多视图适用于静态 HTML 页面的集合,但在重写 URL 的环境中并不是一件好事。
I am not familiar with Rails, but in general, MultiViews enabled can lead to funny behaviour in certain situations - most commonly, it can end up serving a page when an incorrect URL is entered, instead of returning a 404 as it should.
Here is a blog post on another subtle possible problem with MultiViews.
This GoDaddy blog entry points out another problematic consequence:
Bottom line, Multiviews are fine for collections of static HTML pages, but not really a good thing to have in an environment with rewritten URLs.