我有一个长期运行在Mac (apache2)上的Rails应用程序。设置使用Apache虚拟主机和乘客。Rails应用程序还使用HTTP基本身份验证。
我需要将应用程序从一个url域迁移到另一个url域--两个域名的一些重叠可以在一段时间内同时访问。
为此,我在客运虚拟主机配置中将新域名添加为现有域名的ServerAlias。
现在,我可以同时使用遗留的url和来自Safari、Chrome、Firefox或的新url浏览Rails应用程序。
我还可以使用Safari、Chrome或Firefox对Rails应用程序进行“HTTP”更新。一切都很好。
但是,试图从Internet发布更新会导致Rails应用程序拒绝更新,
Rails应用程序日志包含消息,
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):我有其他领域&别名,在同一台机器上运行得很好。
任何关于是什么原因导致Rails应用拒绝来自IE的帖子的建议,我们将不胜感激。
更新:我尝试过将新域更改为ServerName,旧域更改为ServerAlias,但仍然可以获得带有新域名的422。我很困惑。
发布于 2012-11-01 15:15:23
我不知道这是为什么,但希望它能帮到别人.
我发现,如果我已经将新的URL配置为使用相同的子域,那么MSIE中的Rails帖子将被接受。
所以,
如果它被设为,
originalsubdomain.originaldomainname.com如果将新URL设置为,
newsubdomain.newdomainname.com...then Safari、FireFox和Chrome都很高兴,但MSIE会导致Rails在一个帖子上(在多台机器上进行测试)。
但是,如果我将新的URL设置为
originalsubdomain.newdomain.com它完全适用于所有列出的浏览器(在多台计算机上进行测试)。
任何关于为什么会这样的建议,非常感谢。
发布于 2012-10-28 12:15:36
仔细观察日志,您必须有一个未编码的符号。
422意味着您得到了正确的请求,但由于(通常)编码问题,无法处理它。
来自rfc
The 422 (Unprocessable Entity) status code means the server
understands the content type of the request entity (hence a
415(Unsupported Media Type) status code is inappropriate), and the
syntax of the request entity is correct (thus a 400 (Bad Request)
status code is inappropriate) but was unable to process the contained
instructions. For example, this error condition may occur if an XML
request body contains well-formed (i.e., syntactically correct), but
semantically erroneous, XML instructions.https://serverfault.com/questions/443113
复制相似问题