class

Cors::Handler

Inherits HTTP::Handler < Reference < Object

TODO: Handle wildcard origins (*.example.com) in configuration

Constants

ALLOWED_HEADERS_DEFAULT = ["origin", "accept", "content-type", "x-requested-with"]
ALLOWED_METHODS_DEFAULT = ["GET", "POST", "PUT"]
Log = ::Log.for("cors")
VARY_HEADERS = ["Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers"]

Constructors

new(respond_ok : Proc(HTTP::Server::Context, Nil), max_age : Int32 = 0, allow_credentials : Bool = false, allowed_origins : Array(String) = [] of String, allowed_methods : Array(String) = [] of String, allowed_headers : Array(String) = [] of String, exposed_headers : Array(String) = [] of String)
Source

Instance methods

call(ctx : HTTP::Server::Context)
Source