class Aws::Rails::EbsSqsActiveJobMiddleware
def call(env)
def call(env) request = ActionDispatch::Request.new(env) # Pass through unless user agent is the SQS Daemon return @app.call(env) unless from_sqs_daemon?(request) @logger.debug('aws-sdk-rails middleware detected call from Elastic Beanstalk SQS Daemon.') # Only accept requests from this user agent if it is from localhost or a docker host in case of forgery. unless request.local? || sent_from_docker_host?(request) @logger.warn("SQSD request detected from untrusted address #{request.remote_ip}; returning 403 forbidden.") return FORBIDDEN_RESPONSE end # Execute job or periodic task based on HTTP request context periodic_task?(request) ? execute_periodic_task(request) : execute_job(request) end