Jump to content

手册:$wgAllowedCorsHeaders

From mediawiki.org
This page is a translated version of the page Manual:$wgAllowedCorsHeaders and the translation is 29% complete.
API: $wgAllowedCorsHeaders
跨域API请求的允许标头列表。
引进版本:1.35.0​(Gerrit change 585491; git #0ed077d3)
移除版本:仍在使用
允许的值:(数组)
默认值:(参见下方)

Used in the Access-Control-Allow-Headers response for cross-origin requests coming from a domain that is allowed via $wgCrossSiteAJAXdomains or similar settings.

Will be used by both the REST API and the action API. The REST API will allow some headers that are needed for its functionality, even if they are not listed here.

Default value

MediaWiki版本:
≥ 1.47
$wgAllowedCorsHeaders = [
	/* simple headers (see spec) */
	'Accept',
	'Accept-Language',
	'Content-Language',
	'Content-Type',
	/* non-authorable headers in XHR, which are however requested by some UAs */
	'Accept-Encoding',
	'DNT',
	'Origin',
	/* MediaWiki whitelist */
	'User-Agent',
	'Api-User-Agent',
	'Promise-Non-Write-API-Action',
	/* Allowing caching preflight requests, see T269636 */
	'Access-Control-Max-Age',
	/* OAuth 2.0, see T322944 */
	'Authorization',
];
MediaWiki版本:
1.40 – 1.46
Gerrit change 921154

This was backported to MediaWiki 1.35.11, 1.38.7 and 1.39.4.

$wgAllowedCorsHeaders = [
	/* simple headers (see spec) */
	'Accept',
	'Accept-Language',
	'Content-Language',
	'Content-Type',
	/* non-authorable headers in XHR, which are however requested by some UAs */
	'Accept-Encoding',
	'DNT',
	'Origin',
	/* MediaWiki whitelist */
	'User-Agent',
	'Api-User-Agent',
	/* Allowing caching preflight requests, see T269636 */
	'Access-Control-Max-Age',
	/* OAuth 2.0, see T322944 */
	'Authorization',
];
MediaWiki版本:
1.36 – 1.39
Gerrit change 646768

This was backported to MediaWiki 1.35.11.

$wgAllowedCorsHeaders = [
	/* simple headers (see spec) */
	'Accept',
	'Accept-Language',
	'Content-Language',
	'Content-Type',
	/* non-authorable headers in XHR, which are however requested by some UAs */
	'Accept-Encoding',
	'DNT',
	'Origin',
	/* MediaWiki whitelist */
	'User-Agent',
	'Api-User-Agent',
	/* Allowing caching preflight requests, see T269636 */
	'Access-Control-Max-Age',
];
MediaWiki版本:
1.35
$wgAllowedCorsHeaders = [
	/* simple headers (see spec) */
	'Accept',
	'Accept-Language',
	'Content-Language',
	'Content-Type',
	/* non-authorable headers in XHR, which are however requested by some UAs */
	'Accept-Encoding',
	'DNT',
	'Origin',
	/* MediaWiki whitelist */
	'User-Agent',
	'Api-User-Agent',
];