DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Stop Google Web Accelerator In Your Rails Apps

05.07.2005
| 8080 views |
  • submit to reddit
        
class ApplicationController < ActionController::Base
  before_filter :disable_link_prefetching

  private
    def disable_link_prefetching
      if request.env["HTTP_X_MOZ"] == "prefetch" 
        logger.debug "prefetch detected: sending 403 Forbidden" 
        render_nothing "403 Forbidden" 
        return false
      end
    end
end

Code by David Heinemeier Hansson.