google chrome - Getting 404 error sometimes in production environment in Rails application -
i have quiz module on website user take quizzes. have set cache buster in controller:
def set_cache_buster response.headers["cache-control"] = "no-cache, no-store, max-age=0, must-revalidate" response.headers["pragma"] = "no-cache" response.headers["expires"] = "fri, 01 jan 1990 00:00:00 gmt" end
few users getting random 404 error. users using chrome on windows 8.1. daily around 300-400 users take quiz , few of them 404 error. getting difficult track 404 issue notified 500 errors in production , have not faced issue in local or test environment. , concern is, if code issue users should have got there more 30,000 users. idea why happening few of users?
adding more info: not related link, happens randomly. have 3 attempts user clear quiz. few error ask them avail left on attempts , attempt quiz , able to. of time works fine only. other users have completed quiz few report 404 same quiz. example: in exam module questions loaded 1 one. first user goes to: exam_instructions/some_quiz
. user redirect quiz page have form this:
<%= form_tag({:action=> "calc_score",:id => @quiz.slug, :name => 'question'},:method => :post,:id=>'form',:name=>'question') %> <%= submit_tag "submit" %> <% end %>
the user submits , form data goes calc_score quiz id. score gets calculated:
before_filter :find_quiz def calc_score #calculates score current question # redirects show page quiz id next question presented user on show page redirect_to :action=> "show", :id=> @quiz.slug end def show #next question loaded end protected def find_quiz @quiz = quiz.find_by_slug(params[:id]) or raise(activerecord::recordnotfound) if params[:id] end
now when users taking quiz after submitting quiz see 404 error. if @quiz object nil show page not have loaded present. on submission goes wrong few users changes :id undefined or nil , user see's 404 error page 100's of user have completed same quiz.
finally sorted out issue able track of 404 notifications suggested @eugenem. there variable named incorrectly got triggered under circumstances. notification made easier track bug. @eugenem.
Comments
Post a Comment