Policy properties

Allowed Origins

  • "alloworigin" <origin> | *
  • List of origin parameters specifying URIs that may access the resource. For requests without credentials, the server may specify * as a wildcard, thereby allowing any origin to access the resource. It is absolutely not recommended to use Allow-Origin: * in production since it allows every foreign (i.e. attacker) website to make requests that without CORS are strictly prohibited by browsers.

Allowed Origins (Regexp)

  • "alloworiginregexp" <regexp>
  • List of regexp regular expressions specifying URIs that may access the resource. Regular expressions can lead to unintended matches if not carefully built, allowing an attacker to use a custom domain name that would also match the policy. It is generally recommended to have separate policies for each specific origin hostname, using alloworigin, even if that means repeated configuration of the other policy properties. Different origins tend to have different life-cycles and requirements, thus benefitting from clear separation.

Allowed Paths

  • "allowedpaths" <regexp>
  • List of regexp regular expressions specifying resource paths for which the policy applies.

Exposed Headers

  • "exposedheaders" <header>
  • List of header parameters indicating response headers that browsers are allowed to access. For CORS requests (not pre-flight), if not empty these values are copied into the Access-Control-Expose-Headers response header. The values in the list (header names) are then made accessible to the browser; without it, those headers are not readable by the browser.