Rails应用程序返回新的ServerAlias的HTTP 422 – 仅限Internet Explorer

我有一个在Mac OS X(apache2)上运行的长期Rails应用程序。 该设置使用Apache虚拟主机和Passenger。 Rails应用程序也使用HTTP基本authentication。

我需要将应用程序从一个url域迁移到另一个域 – 两个域名可以同时访问一段时间。

为此,我已经在Passenger Virtual Hostconfiguration中将新的域名添加为现有域名的ServerAlias。

我现在可以使用旧版url和来自Safari,Chrome,Firefox或Internet Explorer的新url浏览Rails应用程序。

我也可以使用Safari,Chrome或Firefox将'HTTP发布'更新到Rails应用程序。 都好。

除了尝试从Internet Explorer发布更新导致Rails应用拒绝更新之外,

Rails应用程序日志包含消息,

ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken): 

我有其他域和别名在同一台机器上工作得很好。

任何build议是什么导致Rails应用程序拒绝来自IE的post将不胜感激。

更新:我已经尝试将新域名更改为ServerName,并将旧域名更改为ServerAlias,但仍然使用新域名获得422。 我很困惑。

仔细观察日志,你必须有一个未编码的符号。
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 (ie, syntactically correct), but semantically erroneous, XML instructions. 

我不知道为什么这个工作,但希望它可以帮助别人…

我发现从MSIE的Rails POSTs被接受,如果我已经configuration新的URL使用相同的子域名。

所以,

如果设置为,

 originalsubdomain.originaldomainname.com 

如果设置新的URL为,

 newsubdomain.newdomainname.com 

…然后Safari,FireFox和Chrome都很开心,但是MSIE会导致Rails在一个POST(在几台机器上testing)上被阻止。

但是,如果我设置了新的URL,

 originalsubdomain.newdomain.com 

它完全适用于所有列出的浏览器(在多台机器上testing)。

任何build议, 为什么这可能是,赞赏。