class

Azu::Handler::CORS

Inherits HTTP::Handler < Reference < Object

Constants

ALLOW_HEADERS = ["Accept", "Content-Type"] of ::String
ALLOW_METHODS = ["POST", "PUT", "PATCH", "DELETE"] of ::String
DEFAULT_ORIGINS = [] of (String | Regex)

SECURITY: Empty by default - origins must be explicitly configured Previously was ["*", /./] which allowed all origins

FORBIDDEN = "Forbidden for invalid origins, methods or headers"

Constructors

new(origins : OriginType | Nil = nil, methods : Array(String) = ALLOW_METHODS, headers : Array(String) = ALLOW_HEADERS, credentials : Bool = false, max_age : Int32 | Nil = 0, expose_headers : Array(String) | Nil = nil, vary : String | Nil = nil)
Source

Instance methods

credentials
Source
credentials=(credentials : Bool)
Source
forbidden(context)
Source
headers
Source
headers=(headers : Array(String))
Source
max_age
Source
max_age=(max_age : Int32 | Nil)
Source
methods
Source
methods=(methods : Array(String))
Source
origins
Source
origins=(origins : Array(Regex | String))
Source

Nested types