cors

Add CORS headers to your app in one module

This module detects CORS requests, validates them against the configured origins, and handles preflight requests.

The following is the default configuration.

settings = {
    allowOrigins = "*",
    allowMethods = [ "DELETE", "GET", "PATCH", "POST", "PUT", "OPTIONS" ],
    allowHeaders = [ "Content-Type", "X-Auth-Token", "Origin", "Authorization" ],
    maxAge = 60 * 60 * 24, // 1 day
    allowCredentials = true,
    eventPattern = [ "^Main\.ajax$", "api" ]
};

31 Jan 2018 — 23:23: 01 UTC

chore

  • build: trigger minor release (ef05a5c)

31 Jan 2018 — 23:11: 40 UTC

feat

  • events: Add eventPattern to settings (#2) (b7544a9)

27 Jan 2018 — 06:09: 38 UTC

chore

  • build: Remove unnecessary package scripts (88f7e90)
  • build: Fix ACF builds (dc433de)
  • build: Add Travis CI and Semantic Release (d084e2f)

feat

  • cors: Add isAllowed check and response (36d605e)
  • cors: Send a generic preflight back if none defined (352e20d)

other

 

 
$ box install cors
No collaborators yet.
  • Feb 24 2017 10:35 AM
  • Jan 31 2018 05:23 PM
  • 837
  • 0
  • 1579