Skip to content

Commit a3c1762

Browse files
committed
Update HTTPCORSFilter struct
This updates the Go struct in accordance with the GEP changes from #4281 At the same time, I'm slightly adjusting the wording of the GEP itself.
1 parent d0a4976 commit a3c1762

File tree

2 files changed

+33
-25
lines changed

2 files changed

+33
-25
lines changed

apis/v1/httproute_types.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,10 +1391,9 @@ type HTTPCORSFilter struct {
13911391
// the CORS headers. The cross-origin request fails on the client side.
13921392
// Therefore, the client doesn't attempt the actual cross-origin request.
13931393
//
1394-
// The `Access-Control-Allow-Origin` response header can only use `*`
1395-
// wildcard as value when the `AllowCredentials` field is false or omitted.
1396-
//
1397-
// When the `AllowCredentials` field is true and `AllowOrigins` field
1394+
// When the request is credentialed, the gateway must not specify the `*`
1395+
// wildcard in the `Access-Control-Allow-Origin` response header. When
1396+
// also the `AllowCredentials` field is true and `AllowOrigins` field
13981397
// specified with the `*` wildcard, the gateway must return a single origin
13991398
// in the value of the `Access-Control-Allow-Origin` response header,
14001399
// instead of specifying the `*` wildcard. The value of the header
@@ -1452,15 +1451,19 @@ type HTTPCORSFilter struct {
14521451
// The `Access-Control-Allow-Methods` response header can only use `*`
14531452
// wildcard as value when the `AllowCredentials` field is false or omitted.
14541453
//
1455-
// When the `AllowCredentials` field is true and `AllowMethods` field
1454+
// When the request is credentialed, the gateway must not specify the `*`
1455+
// wildcard in the `Access-Control-Allow-Methods` response header. When
1456+
// also the `AllowCredentials` field is true and `AllowMethods` field
14561457
// specified with the `*` wildcard, the gateway must specify one HTTP method
14571458
// in the value of the Access-Control-Allow-Methods response header. The
14581459
// value of the header `Access-Control-Allow-Methods` is same as the
14591460
// `Access-Control-Request-Method` header provided by the client. If the
14601461
// header `Access-Control-Request-Method` is not included in the request,
14611462
// the gateway will omit the `Access-Control-Allow-Methods` response header,
1462-
// instead of specifying the `*` wildcard. A Gateway implementation may
1463-
// choose to add implementation-specific default methods.
1463+
// instead of specifying the `*` wildcard.
1464+
//
1465+
// A Gateway implementation may choose to add implementation-specific
1466+
// default methods.
14641467
//
14651468
// Support: Extended
14661469
//
@@ -1495,15 +1498,19 @@ type HTTPCORSFilter struct {
14951498
// The `Access-Control-Allow-Headers` response header can only use `*`
14961499
// wildcard as value when the `AllowCredentials` field is false or omitted.
14971500
//
1498-
// When the `AllowCredentials` field is true and `AllowHeaders` field
1501+
// When the request is credentialed, the gateway must not specify the `*`
1502+
// wildcard in the `Access-Control-Allow-Headers` response header. When
1503+
// also the `AllowCredentials` field is true and `AllowHeaders` field
14991504
// specified with the `*` wildcard, the gateway must specify one or more
15001505
// HTTP headers in the value of the `Access-Control-Allow-Headers` response
15011506
// header. The value of the header `Access-Control-Allow-Headers` is same as
15021507
// the `Access-Control-Request-Headers` header provided by the client. If
15031508
// the header `Access-Control-Request-Headers` is not included in the
15041509
// request, the gateway will omit the `Access-Control-Allow-Headers`
1505-
// response header, instead of specifying the `*` wildcard. A Gateway
1506-
// implementation may choose to add implementation-specific default headers.
1510+
// response header, instead of specifying the `*` wildcard.
1511+
//
1512+
// A Gateway implementation may choose to add implementation-specific
1513+
// default headers.
15071514
//
15081515
// Support: Extended
15091516
//
@@ -1539,7 +1546,7 @@ type HTTPCORSFilter struct {
15391546
//
15401547
// A wildcard indicates that the responses with all HTTP headers are exposed
15411548
// to clients. The `Access-Control-Expose-Headers` response header can only
1542-
// use `*` wildcard as value when the `AllowCredentials` field is false or omitted.
1549+
// use `*` wildcard as value when the request is not credentialed.
15431550
//
15441551
// Support: Extended
15451552
//

geps/gep-1767/index.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,13 @@ type HTTPCORSFilter struct {
240240
// Output:
241241
// Access-Control-Allow-Origin: *
242242
//
243-
// When the `allowCredentials` config field is true,
244-
// the `allowOrigins` config field contains the "*" wildcard, and the
245-
// request is credentialed, the gateway must return a
243+
// When the request is credentialed, the gateway must not specify the `*`
244+
// wildcard in the `Access-Control-Allow-Origin` response header. When
245+
// additionally the `AllowCredentials` field is true and `AllowOrigins`
246+
// field specified with the `*` wildcard, the gateway must return a
246247
// single origin in the value of the `Access-Control-Allow-Origin`
247-
// response header, instead of specifying the `*` wildcard.
248-
// (The wildcard is always forbidden in response to a credentialed
249-
// request irrespective of the Gateway configuration.) The value
250-
// of the header `Access-Control-Allow-Origin` is same as the `Origin`
248+
// response header, instead of specifying the `*` wildcard. The value
249+
// of the header `Access-Control-Allow-Origin` is same as the `Origin`
251250
// header provided by the client.
252251
//
253252
// Input:
@@ -338,16 +337,16 @@ type HTTPCORSFilter struct {
338337
// Output:
339338
// Access-Control-Allow-Methods: *
340339
//
341-
// When the `allowCredentials` config field is true and the request is
342-
// credentialed, the gateway must specify one
340+
// When the request is credentialed, the gateway must not specify the `*`
341+
// wildcard in the `Access-Control-Allow-Methods` response header. When
342+
// also the `AllowCredentials` field is true and `AllowMethods`
343+
// field specified with the `*` wildcard, the gateway must specify one
343344
// HTTP method in the value of the Access-Control-Allow-Methods response
344345
// header. The value of the header `Access-Control-Allow-Methods` is same
345346
// as the `Access-Control-Request-Method` header provided by the client.
346347
// If the header `Access-Control-Request-Method` is not included in the
347348
// request, the gateway will omit the `Access-Control-Allow-Methods`
348-
// response header, instead of specifying the `*` wildcard.
349-
// (The wildcard is always forbidden in response to a credentialed
350-
// request irrespective of the Gateway configuration.) A Gateway
349+
// response header, instead of specifying the `*` wildcard. A Gateway
351350
// implementation may choose to add implementation-specific default
352351
// methods.
353352
//
@@ -414,8 +413,10 @@ type HTTPCORSFilter struct {
414413
// Output:
415414
// Access-Control-Allow-Headers: *
416415
//
417-
// When the `allowHeaders` config field contains the "*" wildcard and the request
418-
// is credentialed, the gateway must specify one or more
416+
// When the request is credentialed, the gateway must not specify the `*`
417+
// wildcard in the `Access-Control-Allow-Headers` response header. When
418+
// also the `AllowCredentials` field is true and the `AllowHeaders` field
419+
// is specified with the `*` wildcard, the gateway must specify one or more
419420
// HTTP headers in the value of the `Access-Control-Allow-Headers` response
420421
// header. The value of the header `Access-Control-Allow-Headers` is same as
421422
// the `Access-Control-Request-Headers` header provided by the client. If

0 commit comments

Comments
 (0)