Class: RailsMailerSandbox::Server
- Inherits:
-
Object
- Object
- RailsMailerSandbox::Server
- Defined in:
- lib/rails_mailer_sandbox.rb
Constant Summary collapse
- SECURITY_HEADERS =
{ "content-security-policy" => "default-src 'self'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; frame-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'none'; frame-ancestors 'self'", "referrer-policy" => "no-referrer", "x-content-type-options" => "nosniff", "x-frame-options" => "SAMEORIGIN" }.freeze
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
192 193 194 195 196 197 198 199 200 |
# File 'lib/rails_mailer_sandbox.rb', line 192 def call(env) request = Rack::Request.new(env) response = route(request) response[1] = SECURITY_HEADERS.merge(response[1]) response rescue StandardError => error warn "RailsMailerSandbox: #{error.class}: #{error.}" [500, SECURITY_HEADERS.merge("content-type" => "text/plain; charset=utf-8"), ["Rails Mailer Sandbox error"]] end |