Sha256: bbb3359e8f9dfd1b4df916c76bc899d049665f86a932190236f1cbc7a9506b9f
Contents?: true
Size: 777 Bytes
Versions: 10
Compression:
Stored size: 777 Bytes
Contents
# typed: ignore # 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
10 entries across 10 versions & 1 rubygems