我有一个中间件,用于使用Bonjour在本地网络应用程序上宣布我的应用程序,但是当从rake或通过控制台调用Rails时,它也会宣布该服务.
我想排除这些情况,并且只在Rails作为服务器运行时使用Bonjour中间件.
中间件配置接受proc以在某些条件下使用以下内容排除中间件proc:
config.middleware.insert_before ActionDispatch::Static, Rack::SSL, :exclude => proc { |env|
env['HTTPS'] != 'on'
}
Run Code Online (Sandbox Code Playgroud)
但是,如何确定是从CLI,控制台还是作为服务器调用Rails?
在基于PHP的应用程序的一个部署中,Apache的MultiViews选项用于隐藏请求调度程序脚本的.php扩展名.例如请求
/page/about
Run Code Online (Sandbox Code Playgroud)
......将由...处理
/page.php
Run Code Online (Sandbox Code Playgroud)
...有可用的请求URI的尾部PATH_INFO.
大多数时候这种方法很好,但偶尔会导致错误
[error] [client 86.x.x.x] no acceptable variant: /path/to/document/root/page
Run Code Online (Sandbox Code Playgroud)
我的问题是:偶尔触发此错误的原因是什么,以及如何解决问题?