Sha256: dea9e8f4e57c4bf2be3a4ece0043546cb9024a4788befbeaabec624e7f0549e9
Contents?: true
Size: 776 Bytes
Versions: 29
Compression:
Stored size: 776 Bytes
Contents
# typed: false # Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.com/terms.html require 'sqreen/attack_blocked' module Sqreen class ErrorHandlingMiddleware def initialize(app) @app = app end def call(env) @app.call(env) rescue StandardError => e sqreen_attack = nil if e.is_a?(Sqreen::AttackBlocked) sqreen_attack = e elsif e.respond_to?(:original_exception) && e.original_exception.is_a?(Sqreen::AttackBlocked) sqreen_attack = e.original_exception end if sqreen_attack && sqreen_attack.redirect_url return [303, { 'Location' => sqreen_attack.redirect_url }, ['']] end raise end end end
Version data entries
29 entries across 29 versions & 1 rubygems