1

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.

2 Answers 2

0

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.
1
  • 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, 2012 at 12:27
0

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.

So,

If it's set up as,

originalsubdomain.originaldomainname.com

If a set up the new URL as,

newsubdomain.newdomainname.com

...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,

originalsubdomain.newdomain.com

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

Any suggestions as to why this might be, appreciated.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .