Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails and strange HTTP_ACCEPT header from PSP

I have Ruby on Rails app (3.1rc4) and I am constantly getting a couple of exceptions each day with the same user agent (Mozilla/4.0 (PSP (PlayStation Portable); 2.00)). Exception:

A ActionView::MissingTemplate occurred in home#index:
Missing template home/index, application/index with {:formats=>["*/*;q=0.01"], :locale=>[:en, :en], :handlers=>[:erb, :builder, :arb]}. Searched in:
"/var/www/releases/20110721144523/app/views"

I do have app/views/home/index.html.erb, but looks like it tries to find a file for a very strange request format "/;q=0.01".

HTTP Header:

 * HTTP_ACCEPT                               : */*;q=0.01

Anyone can help me with this problem?

like image 524
Andrey Chernih Avatar asked Jul 21 '11 15:07

Andrey Chernih


1 Answers

This is a common problem, see the ticket on Github.

You can choose to render HTML explicitly; just write render "index.html" instead of render. This will return HTML instead of a 406 though. I hope there are better solutions.

like image 126
icecream Avatar answered Oct 23 '22 14:10

icecream