@@ -1303,49 +1303,40 @@ type HTTPRequestMirrorFilter struct {
1303
1303
// HTTPCORSFilter defines a filter that that configures Cross-Origin Request
1304
1304
// Sharing (CORS).
1305
1305
type HTTPCORSFilter struct {
1306
- // AllowOrigins indicates whether the response can be shared with
1307
- // requested resource from the given `Origin`.
1306
+ // AllowOrigins indicates whether the response can be shared with requested
1307
+ // resource from the given `Origin`.
1308
1308
//
1309
- // The `Origin` consists of a scheme and a host, with an optional
1310
- // port, and takes the form `<scheme>://<host>(:<port>)`.
1309
+ // The `Origin` consists of a scheme and a host, with an optional port, and
1310
+ // takes the form `<scheme>://<host>(:<port>)`.
1311
1311
//
1312
1312
// Valid values for scheme are: `http` and `https`.
1313
1313
//
1314
- // Valid values for port are any integer between 1 and 65535
1315
- // (the list of available TCP/UDP ports). Note that, if not included,
1316
- // port `80` is assumed for `http` scheme origins, and port `443`
1317
- // is assumed for `https` origins. This may affect origin matching.
1314
+ // Valid values for port are any integer between 1 and 65535 (the list of
1315
+ // available TCP/UDP ports). Note that, if not included, port `80` is
1316
+ // assumed for `http` scheme origins, and port `443` is assumed for `https `
1317
+ // origins. This may affect origin matching.
1318
1318
//
1319
- // The host part of the origin may contain the wildcard character `*`.
1320
- // These wildcard characters behave as follows:
1319
+ // The host part of the origin may contain the wildcard character `*`. These
1320
+ // wildcard characters behave as follows:
1321
1321
//
1322
1322
// * `*` is a greedy match to the _left_, including any number of
1323
1323
// DNS labels to the left of its position. This also means that
1324
1324
// `*` will include any number of period `.` characters to the
1325
1325
// left of its position.
1326
1326
// * A wildcard by itself matches all hosts.
1327
1327
//
1328
- // An origin value that includes _only_ the `*` character
1329
- // indicates requests from all `Origin`s are allowed.
1328
+ // An origin value that includes _only_ the `*` character indicates requests
1329
+ // from all `Origin`s are allowed.
1330
1330
//
1331
- // When the `AllowOrigins` field is configured with multiple
1332
- // origins, it means the server supports clients from multiple
1333
- // origins. If the request `Origin` matches the configured
1334
- // allowed origins, the gateway must return the given `Origin`
1335
- // and sets value of the header `Access-Control-Allow-Origin`
1336
- // same as the `Origin` header provided by the client.
1331
+ // When the `AllowOrigins` field is configured with multiple origins, it
1332
+ // means the server supports clients from multiple origins. If the request
1333
+ // `Origin` matches the configured allowed origins, the gateway must return
1334
+ // the given `Origin` and sets value of the header
1335
+ // `Access-Control-Allow-Origin` same as the `Origin` header provided by the
1336
+ // client.
1337
1337
//
1338
- // The status code of a successful response to a "preflight"
1339
- // request is always an OK status (i.e., 204 or 200).
1340
- //
1341
- // Input:
1342
- // Origin: https://foo.example
1343
- //
1344
- // Config:
1345
- // allowOrigins: ["https://foo.example", "http://foo.example", "https://test.example", "http://test.example"]
1346
- //
1347
- // Output:
1348
- // Access-Control-Allow-Origin: https://foo.example
1338
+ // The status code of a successful response to a "preflight" request is
1339
+ // always an OK status (i.e., 204 or 200).
1349
1340
//
1350
1341
// If the request `Origin` does not match the configured allowed origins,
1351
1342
// the gateway returns 204/200 response but doesn't set the relevant
@@ -1354,76 +1345,38 @@ type HTTPCORSFilter struct {
1354
1345
// the CORS headers. The cross-origin request fails on the client side.
1355
1346
// Therefore, the client doesn't attempt the actual cross-origin request.
1356
1347
//
1357
- // Input:
1358
- // Origin: https://foo.example
1359
- //
1360
- // Config:
1361
- // allowOrigins: ["https://test.example", "http://test.example"]
1362
- //
1363
- // Output:
1364
- //
1365
1348
// The `Access-Control-Allow-Origin` response header can only use `*`
1366
1349
// wildcard as value when the `AllowCredentials` field is unspecified.
1367
1350
//
1368
- // Input:
1369
- // Origin: https://foo.example
1370
- //
1371
- // Config:
1372
- // allowOrigins: ["*"]
1373
- //
1374
- // Output:
1375
- // Access-Control-Allow-Origin: *
1376
- //
1377
- // When the `AllowCredentials` field is specified and `AllowOrigins`
1378
- // field specified with the `*` wildcard, the gateway must return a
1379
- // single origin in the value of the `Access-Control-Allow-Origin`
1380
- // response header, instead of specifying the `*` wildcard. The value
1381
- // of the header `Access-Control-Allow-Origin` is same as the `Origin`
1382
- // header provided by the client.
1383
- //
1384
- // Input:
1385
- // Origin: https://foo.example
1386
- //
1387
- // Config:
1388
- // allowOrigins: ["*"]
1389
- // allowCredentials: true
1390
- //
1391
- // Output:
1392
- // Access-Control-Allow-Origin: https://foo.example
1393
- // Access-Control-Allow-Credentials: true
1351
+ // When the `AllowCredentials` field is specified and `AllowOrigins` field
1352
+ // specified with the `*` wildcard, the gateway must return a single origin
1353
+ // in the value of the `Access-Control-Allow-Origin` response header,
1354
+ // instead of specifying the `*` wildcard. The value of the header
1355
+ // `Access-Control-Allow-Origin` is same as the `Origin` header provided by
1356
+ // the client.
1394
1357
//
1395
1358
// Support: Extended
1396
1359
// +listType=set
1397
1360
// +kubebuilder:validation:MaxItems=64
1398
1361
AllowOrigins []AbsoluteURI `json:"allowOrigins,omitempty"`
1399
1362
1400
- // AllowCredentials indicates whether the actual cross-origin request
1401
- // allows to include credentials.
1363
+ // AllowCredentials indicates whether the actual cross-origin request allows
1364
+ // to include credentials.
1402
1365
//
1403
- // The only valid value for the `Access-Control-Allow-Credentials`
1404
- // response header is true (case-sensitive).
1366
+ // The only valid value for the `Access-Control-Allow-Credentials` response
1367
+ // header is true (case-sensitive).
1405
1368
//
1406
- // Input:
1407
- // Origin: https://foo.example
1408
- //
1409
- // Config:
1410
- // allowCredentials: true
1411
- //
1412
- // Output:
1413
- // Access-Control-Allow-Origin: https://foo.example
1414
- // Access-Control-Allow-Credentials: true
1415
- //
1416
- // If the credentials are not allowed in cross-origin requests,
1417
- // the gateway will omit the header `Access-Control-Allow-Credentials`
1418
- // entirely rather than setting its value to false.
1369
+ // If the credentials are not allowed in cross-origin requests, the gateway
1370
+ // will omit the header `Access-Control-Allow-Credentials` entirely rather
1371
+ // than setting its value to false.
1419
1372
//
1420
1373
// Support: Extended
1421
1374
//
1422
1375
// +optional
1423
1376
AllowCredentials * LowercaseTrue `json:"allowCredentials,omitempty"`
1424
1377
1425
- // AllowMethods indicates which HTTP methods are supported
1426
- // for accessing the requested resource.
1378
+ // AllowMethods indicates which HTTP methods are supported for accessing the
1379
+ // requested resource.
1427
1380
//
1428
1381
// Valid values are any method defined by RFC9110, along with the special
1429
1382
// value `*`, which represents all HTTP methods are allowed.
@@ -1435,130 +1388,72 @@ type HTTPCORSFilter struct {
1435
1388
// response header are separated by a comma (",").
1436
1389
//
1437
1390
// A CORS-safelisted method is a method that is `GET`, `HEAD`, or `POST`.
1438
- // (See https://fetch.spec.whatwg.org/#cors-safelisted-method)
1439
- // The CORS-safelisted methods are always allowed, regardless of whether
1440
- // they are specified in the `AllowMethods` field.
1391
+ // (See https://fetch.spec.whatwg.org/#cors-safelisted-method) The
1392
+ // CORS-safelisted methods are always allowed, regardless of whether they
1393
+ // are specified in the `AllowMethods` field.
1441
1394
//
1442
- // When the `AllowMethods` field is configured with one or more methods,
1443
- // the gateway must return the `Access-Control-Allow-Methods` response
1444
- // header which value is present in the `AllowMethods` field.
1395
+ // When the `AllowMethods` field is configured with one or more methods, the
1396
+ // gateway must return the `Access-Control-Allow-Methods` response header
1397
+ // which value is present in the `AllowMethods` field.
1445
1398
//
1446
1399
// If the HTTP method of the `Access-Control-Request-Method` request header
1447
1400
// is not included in the list of methods specified by the response header
1448
1401
// `Access-Control-Allow-Methods`, it will present an error on the client
1449
1402
// side.
1450
1403
//
1451
- // Input:
1452
- // Access-Control-Request-Method: PUT
1453
- //
1454
- // Config:
1455
- // allowMethods: ["GET", "POST", "DELETE", "PATCH", "OPTIONS"]
1456
- //
1457
- // Output:
1458
- // Access-Control-Allow-Methods: GET, POST, DELETE, PATCH, OPTIONS
1459
- //
1460
1404
// The `Access-Control-Allow-Methods` response header can only use `*`
1461
1405
// wildcard as value when the `AllowCredentials` field is unspecified.
1462
1406
//
1463
- // Input:
1464
- // Access-Control-Request-Method: PUT
1465
- //
1466
- // Config:
1467
- // allowMethods: ["*"]
1468
- //
1469
- // Output:
1470
- // Access-Control-Allow-Methods: *
1471
- //
1472
- // When the `AllowCredentials` field is specified and `AllowMethods`
1473
- // field specified with the `*` wildcard, the gateway must specify one
1474
- // HTTP method in the value of the Access-Control-Allow-Methods response
1475
- // header. The value of the header `Access-Control-Allow-Methods` is same
1476
- // as the `Access-Control-Request-Method` header provided by the client.
1477
- // If the header `Access-Control-Request-Method` is not included in the
1478
- // request, the gateway will omit the `Access-Control-Allow-Methods`
1479
- // response header, instead of specifying the `*` wildcard. A Gateway
1480
- // implementation may choose to add implementation-specific default
1481
- // methods.
1482
- //
1483
- // Input:
1484
- // Access-Control-Request-Method: PUT
1485
- //
1486
- // Config:
1487
- // allowMethods: ["*"]
1488
- // allowCredentials: true
1489
- //
1490
- // Output:
1491
- // Access-Control-Allow-Methods: PUT
1492
- // Access-Control-Allow-Credentials: true
1407
+ // When the `AllowCredentials` field is specified and `AllowMethods` field
1408
+ // specified with the `*` wildcard, the gateway must specify one HTTP method
1409
+ // in the value of the Access-Control-Allow-Methods response header. The
1410
+ // value of the header `Access-Control-Allow-Methods` is same as the
1411
+ // `Access-Control-Request-Method` header provided by the client. If the
1412
+ // header `Access-Control-Request-Method` is not included in the request,
1413
+ // the gateway will omit the `Access-Control-Allow-Methods` response header,
1414
+ // instead of specifying the `*` wildcard. A Gateway implementation may
1415
+ // choose to add implementation-specific default methods.
1493
1416
//
1494
1417
// Support: Extended
1495
1418
//
1496
1419
// +listType=set
1497
1420
// +kubebuilder:validation:MaxItems=9
1498
- // +kubebuilder:validation:UniqueItems=true
1499
1421
AllowMethods []HTTPMethodWithWildcard `json:"allowMethods,omitempty"`
1500
1422
1501
- // AllowHeaders indicates which HTTP request headers are supported
1502
- // for accessing the requested resource.
1423
+ // AllowHeaders indicates which HTTP request headers are supported for
1424
+ // accessing the requested resource.
1503
1425
//
1504
1426
// Header names are not case sensitive.
1505
1427
//
1506
1428
// Multiple header names in the value of the `Access-Control-Allow-Headers`
1507
1429
// response header are separated by a comma (",").
1508
1430
//
1509
- // When the `AllowHeaders` field is configured with one or more headers,
1510
- // the gateway must return the `Access-Control-Allow-Headers` response
1511
- // header which value is present in the `AllowHeaders` field.
1431
+ // When the `AllowHeaders` field is configured with one or more headers, the
1432
+ // gateway must return the `Access-Control-Allow-Headers` response header
1433
+ // which value is present in the `AllowHeaders` field.
1512
1434
//
1513
1435
// If any header name in the `Access-Control-Request-Headers` request header
1514
- // is not included in the list of header names specified by the response header
1515
- // `Access-Control-Allow-Headers`, it will present an error on the client side.
1436
+ // is not included in the list of header names specified by the response
1437
+ // header `Access-Control-Allow-Headers`, it will present an error on the
1438
+ // client side.
1516
1439
//
1517
- // If any header name in the `Access-Control-Allow-Headers` response header does
1518
- // not recognize by the client, it will also occur an error on the client side.
1519
- //
1520
- // Input:
1521
- // Access-Control-Request-Headers: Cache-Control, Content-Type
1522
- //
1523
- // Config:
1524
- // allowHeaders: ["DNT", "Keep-Alive", "User-Agent", "X-Requested-With", "If-Modified-Since", "Cache-Control", "Content-Type", "Range", "Authorization"]
1525
- //
1526
- // Output:
1527
- // Access-Control-Allow-Headers: DNT, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range, Authorization
1440
+ // If any header name in the `Access-Control-Allow-Headers` response header
1441
+ // does not recognize by the client, it will also occur an error on the
1442
+ // client side.
1528
1443
//
1529
1444
// A wildcard indicates that the requests with all HTTP headers are allowed.
1530
- // The `Access-Control-Allow-Headers` response header can only use `*` wildcard
1531
- // as value when the `AllowCredentials` field is unspecified.
1532
- //
1533
- // Input:
1534
- // Access-Control-Request-Headers: Content-Type, Cache-Control
1535
- //
1536
- // Config:
1537
- // allowHeaders: ["*"]
1538
- //
1539
- // Output:
1540
- // Access-Control-Allow-Headers: *
1445
+ // The `Access-Control-Allow-Headers` response header can only use `*`
1446
+ // wildcard as value when the `AllowCredentials` field is unspecified.
1541
1447
//
1542
1448
// When the `AllowCredentials` field is specified and `AllowHeaders` field
1543
1449
// specified with the `*` wildcard, the gateway must specify one or more
1544
1450
// HTTP headers in the value of the `Access-Control-Allow-Headers` response
1545
1451
// header. The value of the header `Access-Control-Allow-Headers` is same as
1546
1452
// the `Access-Control-Request-Headers` header provided by the client. If
1547
- // the header `Access-Control-Request-Headers` is not included in the request,
1548
- // the gateway will omit the `Access-Control-Allow-Headers` response header,
1549
- // instead of specifying the `*` wildcard. A Gateway implementation may choose
1550
- // to add implementation-specific default headers.
1551
- //
1552
- // Input:
1553
- // Access-Control-Request-Headers: Content-Type, Cache-Control
1554
- //
1555
- // Config:
1556
- // allowHeaders: ["*"]
1557
- // allowCredentials: true
1558
- //
1559
- // Output:
1560
- // Access-Control-Allow-Headers: Content-Type, Cache-Control
1561
- // Access-Control-Allow-Credentials: true
1453
+ // the header `Access-Control-Request-Headers` is not included in the
1454
+ // request, the gateway will omit the `Access-Control-Allow-Headers`
1455
+ // response header, instead of specifying the `*` wildcard. A Gateway
1456
+ // implementation may choose to add implementation-specific default headers.
1562
1457
//
1563
1458
// Support: Extended
1564
1459
//
@@ -1582,29 +1477,19 @@ type HTTPCORSFilter struct {
1582
1477
// (See https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name)
1583
1478
// The CORS-safelisted response headers are exposed to client by default.
1584
1479
//
1585
- // When an HTTP header name is specified using the `ExposeHeaders` field, this
1586
- // additional header will be exposed as part of the response to the client.
1480
+ // When an HTTP header name is specified using the `ExposeHeaders` field,
1481
+ // this additional header will be exposed as part of the response to the
1482
+ // client.
1587
1483
//
1588
1484
// Header names are not case sensitive.
1589
1485
//
1590
1486
// Multiple header names in the value of the `Access-Control-Expose-Headers`
1591
1487
// response header are separated by a comma (",").
1592
1488
//
1593
- // Config:
1594
- // exposeHeaders: ["Content-Security-Policy", "Content-Encoding"]
1595
- //
1596
- // Output:
1597
- // Access-Control-Expose-Headers: Content-Security-Policy, Content-Encoding
1598
- //
1599
1489
// A wildcard indicates that the responses with all HTTP headers are exposed
1600
- // to clients. The `Access-Control-Expose-Headers` response header can only use
1601
- // `*` wildcard as value when the `AllowCredentials` field is unspecified.
1602
- //
1603
- // Config:
1604
- // exposeHeaders: ["*"]
1605
- //
1606
- // Output:
1607
- // Access-Control-Expose-Headers: *
1490
+ // to clients. The `Access-Control-Expose-Headers` response header can only
1491
+ // use `*` wildcard as value when the `AllowCredentials` field is
1492
+ // unspecified.
1608
1493
//
1609
1494
// Support: Extended
1610
1495
//
@@ -1613,26 +1498,15 @@ type HTTPCORSFilter struct {
1613
1498
// +kubebuilder:validation:MaxItems=64
1614
1499
ExposeHeaders []HTTPHeaderName `json:"exposeHeaders,omitempty"`
1615
1500
1616
- // MaxAge indicates the duration (in seconds) for the client to cache
1617
- // the results of a "preflight" request.
1501
+ // MaxAge indicates the duration (in seconds) for the client to cache the
1502
+ // results of a "preflight" request.
1618
1503
//
1619
1504
// The information provided by the `Access-Control-Allow-Methods` and
1620
1505
// `Access-Control-Allow-Headers` response headers can be cached by the
1621
1506
// client until the time specified by `Access-Control-Max-Age` elapses.
1622
1507
//
1623
- // The default value of `Access-Control-Max-Age` response header is
1624
- // 5 (seconds).
1625
- //
1626
- // When the `MaxAge` field is unspecified, the gateway sets the response
1627
- // header "Access-Control-Max-Age: 5" by default.
1628
- //
1629
- // Config:
1630
- // maxAge: 1728000
1631
- //
1632
- // Output:
1633
- // Access-Control-Max-Age: 1728000
1634
- //
1635
- // Support: Extended
1508
+ // The default value of `Access-Control-Max-Age` response header is 5
1509
+ // (seconds).
1636
1510
//
1637
1511
// +optional
1638
1512
// +kubebuilder:default=5
0 commit comments