@@ -2879,15 +2879,14 @@ element, a <a>CORS-preflight request</a> is performed, to ensure <a for=/>reques
2879
2879
<h4 id=http-requests>HTTP requests</h4>
2880
2880
2881
2881
<p> A <dfn export>CORS request</dfn> is an HTTP request that includes an
2882
- `<a http-header><code>Origin</code></a> ` header. It cannot be reliably identified as participating in
2883
- the <a>CORS protocol</a> as the `<a http-header><code>Origin</code></a> ` header is also included for
2884
- all <a for=/>requests</a> whose <a for=request>method</a> is neither `<code> GET</code> ` nor
2882
+ `<a http-header><code>Origin</code></a> ` header. It cannot be reliably identified as participating
2883
+ in the <a>CORS protocol</a> as the `<a http-header><code>Origin</code></a> ` header is also included
2884
+ for all <a for=/>requests</a> whose <a for=request>method</a> is neither `<code> GET</code> ` nor
2885
2885
`<code> HEAD</code> `.
2886
2886
2887
- <p> A <dfn id=cors-preflight-request export>CORS-preflight request</dfn> is a <a>CORS request</a> that checks to see
2888
- if the <a>CORS protocol</a> is understood. It uses `<code> OPTIONS</code> ` as
2889
- <a for=/>method</a> and includes these
2890
- <a for=/>headers</a> :
2887
+ <p> A <dfn id=cors-preflight-request export>CORS-preflight request</dfn> is a <a>CORS request</a>
2888
+ that checks to see if the <a>CORS protocol</a> is understood. It uses `<code> OPTIONS</code> ` as
2889
+ <a for=/>method</a> and includes these <a for=/>headers</a> :
2891
2890
2892
2891
<dl>
2893
2892
<dt> `<dfn export http-header id=http-access-control-request-method><code>Access-Control-Request-Method</code></dfn> `
@@ -2958,10 +2957,35 @@ if the <a>CORS protocol</a> is understood. It uses `<code>OPTIONS</code>` as
2958
2957
2959
2958
<hr>
2960
2959
2961
- <p> In case a server does not wish to participate in the <a>CORS protocol</a> , its HTTP response to
2962
- the <a lt="CORS request">CORS</a> or <a>CORS-preflight request</a> must not include any of the above
2963
- <a for=/>headers</a> . The server is encouraged to use the 403 <a for=/>status</a> in such HTTP
2964
- responses.
2960
+ <p> A successful HTTP response, i.e., one where the server developer intends to share it, to a
2961
+ <a>CORS request</a> can use any <a for=/>status</a> , as long as it includes the <a for=/>headers</a>
2962
+ stated above with <a for=header>values</a> matching up with the request.
2963
+
2964
+ <p> A successful HTTP response to a <a>CORS-preflight request</a> is similar, except it is restricted
2965
+ to an <a for=/>ok status</a> , e.g., 200 or 204.
2966
+
2967
+ <p> Any other kind of HTTP response is not successful and will either end up not being shared or fail
2968
+ the <a>CORS-preflight request</a> . Be aware that any work the server performs might nonetheless leak
2969
+ through side channels, such as timing. If server developers wish to denote this explicitly, the 403
2970
+ <a for=/>status</a> can be used, coupled with omitting the relevant <a for=/>headers</a> .
2971
+
2972
+ <p class=note> If desired, “failure” could also be shared, but that would make it a successful HTTP
2973
+ response. That is why for a successful HTTP response to a <a>CORS request</a> that is not a
2974
+ <a>CORS-preflight requests</a> the <a for=/>status</a> can be anything, including 403.
2975
+
2976
+ <p> Ultimately server developers have a lot of freedom in how they handle HTTP responses and these
2977
+ tactics can differ between the response to the <a>CORS-preflight request</a> and the
2978
+ <a>CORS request</a> that follows it:
2979
+
2980
+ <ul>
2981
+ <li><p> They can provide a static response. This can be helpful when working with caching
2982
+ intermediaries. A static response can both be successful and not successful depending on the
2983
+ <a>CORS request</a> . This is okay.
2984
+
2985
+ <li><p> They can provide a dynamic response, tuned to <a>CORS request</a> . This can be helpful when
2986
+ the response body is to be tailored to a specific origin or a response needs to have credentials
2987
+ and be successful for a set of origins.
2988
+ </ul>
2965
2989
2966
2990
2967
2991
<h4 id=http-new-header-syntax>HTTP new-header syntax</h4>
@@ -8086,6 +8110,7 @@ Raphael Kubo da Costa,
8086
8110
Robert Linder,
8087
8111
Rondinelly,
8088
8112
Rory Hewitt,
8113
+ Ross A. Baker,
8089
8114
Ryan Sleevi,
8090
8115
Samy Kamkar,
8091
8116
Sébastien Cevey,
0 commit comments