I have a long-standing Rails app running on Mac OS X (apache2). The set-up uses Apache virtual hosts and Passenger. The Rails app also uses HTTP Basic Authentication.

I need to migrate the app from one url domain to another - with some overlap of both domain names being accessible simultaneously for a period.

To do this, I've added the new domain name as a ServerAlias of the existing domain name in the Passenger Virtual Host config.

I can now Browse the Rails app using both the legacy url, and the new url from any of Safari, Chrome, Firefox, or Internet Explorer.

I can also 'HTTP post' updates to the Rails app using Safari, Chrome, or Firefox. All good.

Except, attempts to post updates from Internet Explorer result in the Rails app rejecting the update,

The Rails app log contains the message,

ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):

I have other domains & aliases working just fine on this same machine.

Any suggestions as to what is causing the Rails app to reject posts from IE would be appreciated.

UPDATE: I've tried changing the new domain to be ServerName, and the old domain to be the ServerAlias, but still get the 422 with the new domain name. I'm baffled.


Watch the logs closely, you must have an unencoded symbol there.
422 means that you got a correct request, but it can't be processed due to (generally) encoding problems.

From the 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.
  • Thanks for the reply. The app works perfectly well with IE when using the original domain so, unless I'm missing something, I don't think it's an encoding problem. It seems to be the authentication code being used that's causing the issue (it suspects a CSRF). – Snips Oct 28 '12 at 12:27

I don't know why this works, but in the hope that it helps someone else...

I found that Rails POSTs from MSIE are accepted if I've configured the new URL to use the same subdomain.


If it's set up as,


If a set up the new URL as,


...then Safari, FireFox and Chrome are all happy, but MSIE causes Rails to baulk on a POST (tested across several machines).

However, if I set up the new URL to be,


It works fully with all the listed browsers (tested across several machines).

Any suggestions as to why this might be, appreciated.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.