Class: Jets::Shim::Adapter::Alb

Inherits:
Apigw show all
Defined in:
lib/jets/shim/adapter/alb.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #event, #target

Instance Method Summary collapse

Methods inherited from Apigw

#path_info

Methods inherited from Web

#base_env, #body, #content_length, #handle, #headers, #headers_env, #host, #http_cookie, #https, #remote_addr, #request_uri, #shim_host, #special_headers, #to_rack_env, #translate_response

Methods inherited from Base

#initialize

Methods included from Util::Logging

#log

Constructor Details

This class inherits a constructor from Jets::Shim::Adapter::Base

Instance Method Details

#envObject



3
4
5
6
7
8
9
# File 'lib/jets/shim/adapter/alb.rb', line 3

def env
  super.merge(
    "HTTP_PORT" => headers["x-forwarded-port"],
    "SERVER_PORT" => headers["x-forwarded-port"],
    "SERVER_PROTOCOL" => event.dig("requestContext", "protocol") || "HTTP/1.1"
  )
end

#handle?Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/jets/shim/adapter/alb.rb', line 11

def handle?
  host =~ /elb\.amazonaws\.com/ ||
    event.dig("requestContext", "elb")
end