blob: a67915032a938ebf281fd44402bfa5af3076cb33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
---
title: Access-Control-Allow-Methods
slug: Web/HTTP/Headers/Access-Control-Allow-Methods
tags:
- 跨域资源共享
- 首部
translation_of: Web/HTTP/Headers/Access-Control-Allow-Methods
---
<p>{{HTTPSidebar}}</p>
<p>响应首部 <strong><code>Access-Control-Allow-Methods</code></strong> 在对 {{glossary("preflight request")}}.(预检请求)的应答中明确了客户端所要访问的资源允许使用的方法或方法列表。</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">报头类型</th>
<td>{{Glossary("Response header")}}</td>
</tr>
<tr>
<th scope="row">{{Glossary("Forbidden header name")}}</th>
<td>no</td>
</tr>
</tbody>
</table>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">Access-Control-Allow-Methods: <method>, <method>, ...
</pre>
<h2 id="指令">指令</h2>
<dl>
<dt><method></dt>
<dd>用逗号隔开的允许使用的 <a href="/en-US/docs/Web/HTTP/Methods">HTTP request methods</a> 列表。</dd>
</dl>
<h2 id="例子">例子</h2>
<pre>Access-Control-Allow-Methods: POST, GET, OPTIONS</pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">规范</th>
<th scope="col">状态</th>
<th scope="col">注释</th>
</tr>
<tr>
<td>{{SpecName('Fetch','#http-access-control-allow-methods', 'Access-Control-Allow-Methods')}}</td>
<td>{{Spec2("Fetch")}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("http.headers.Access-Control-Allow-Methods")}}</p>
<h2 id="兼容性注解">兼容性注解</h2>
<ul>
<li>最新规范中提到的通配符值(*)尚未在以下浏览器中实现:
<ul>
<li>Chromium: <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=615313">Issue 615313</a></li>
<li>Firefox: {{bug(1309358)}}</li>
<li>Servo: <a href="https://github.com/servo/servo/issues/13283">Issue 13283</a></li>
</ul>
</li>
</ul>
<h2 id="查看更多">查看更多</h2>
<ul>
<li>{{HTTPHeader("Access-Control-Allow-Origin")}}</li>
<li>{{HTTPHeader("Access-Control-Expose-Headers")}}</li>
<li>{{HTTPHeader("Access-Control-Allow-Headers")}}</li>
<li>{{HTTPHeader("Access-Control-Request-Method")}}</li>
</ul>
|