pragmatist
Patrick Joyce

December 2, 2008

Alexa Web Crawler - TamperedWithCookie Error

I’ve recently started receiving a ton of CGI::Session::CookieStore::TamperedWithCookie errors on an application I manage. All of the errors are coming from the Alexa Web Crawler.

The application is using the Cookie Session Store (Railscast) introduced in Rails 2. Upon inspection it appears that the problem is related to the newline characters rails inserts every 60 characters. Rails encodes these newlines as %0A. The alexa web crawler seems to convert these to \n. This is the only difference between the two cookies that I can see.

Rails Cookie:

<code>
_application_session=BAh7CToMY3NyZl9pZCIlZDA1ODAzY2MwZGZjNzJkN2I4NGFjZTE5OTcxNzZh%0ANjI6FnNlYXJjaF9jYXRlZ29yaWVzWxRvOg1DYXRlZ29yeQc6FkBhdHRyaWJ1%0AdGVzX2NhY2hlewA6EEBhdHRyaWJ1dGVzewciCW5hbWUiFUF1dG8gLyBUcmFu%0Ac3BvcnQiB2lkIgYxbzsHBzsIewA7CXsHIgluYW1lIhNCZWF1dHkgLyBJbWFn%0AZSIHaWQiBjVvOwcHOwh7ADsJewciCW5hbWUiEkJvYXQgLyBNYXJpbmUiB2lk%0AIggxMTVvOwcHOwh7ADsJewciCW5hbWUiFUJ1c2luZXNzIC8gQWRtaW4iB2lk%0AIgY5bzsHBzsIewA7CXsHIgluYW1lIhRDb21wdXRlciAvIFRlY2giB2lkIgcx%0AMW87Bwc7CHsAOwl7ByIJbmFtZSIVQ3JlYXRpdmUgLyBNZWRpYSIHaWQiBzEy%0AbzsHBzs;
</code>

Alexa Crawler Request Cookie:

<code>
_application_session=BAh7CToMY3NyZl9pZCIlOGJlNGQ2ZGYzYWZjODRhZGI4YmNlMWUxZTkwNmNl\nYjA6FnNlYXJjaF9jYXRlZ29yaWVzWxRvOg1DYXRlZ29yeQc6FkBhdHRyaWJ1\ndGVzX2NhY2hlewA6EEBhdHRyaWJ1dGVzewciCW5hbWUiFUF1dG8gLyBUcmFu\nc3BvcnQiB2lkIgYxbzsHBzsIewA7CXsHIgluYW1lIhNCZWF1dHkgLyBJbWFn\nZSIHaWQiBjVvOwcHOwh7ADsJewciCW5hbWUiEkJvYXQgLyBNYXJpbmUiB2lk\nIggxMTVvOwcHOwh7ADsJewciCW5hbWUiFUJ1c2luZXNzIC8gQWRtaW4iB2lk\nIgY5bzsHBzsIewA7CXsHIgluYW1lIhRDb21wdXRlciAvIFRlY2giB2lkIgcx\nMW87Bwc7CHsAOwl7ByIJbmFtZSIVQ3JlYXRpdmUgLyBNZWRpYSIHaWQiBzEy\nbzsHBzs
</code>

I’m not the only person having this problem. Any ideas?

More Articles on Software & Product Development

Agile With a Lowercase “a”
”Agile“ is an adjective. It is not a noun. It isn’t something you do, it is something you are.
How Do You End Up With A Great Product A Year From Now?
Nail the next two weeks. 26 times in a row.
Build it Twice
Resist the urge to abstract until you've learned what is general to a class of problems and what is specific to each problem.