Skip to content

Commit cfe8bf0

Browse files
docs(cors): show allowCredentials in the CORS task
1 parent fae7f19 commit cfe8bf0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • site/content/en/latest/tasks/security

site/content/en/latest/tasks/security/cors.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ In addition to that the entire origin (with or without specifying a scheme) can
2525
### Configuring CORS with SecurityPolicy
2626

2727
The below example defines a SecurityPolicy that allows CORS for requests originating from `http://*.foo.com`.
28+
It also enables credentialed requests with `allowCredentials: true`.
2829

2930
{{< tabpane text=true >}}
3031
{{% tab header="Apply from stdin" %}}
@@ -43,6 +44,7 @@ spec:
4344
cors:
4445
allowOrigins:
4546
- "http://*.foo.com"
47+
allowCredentials: true
4648
allowMethods:
4749
- GET
4850
- POST
@@ -73,6 +75,7 @@ spec:
7375
cors:
7476
allowOrigins:
7577
- "http://*.foo.com"
78+
allowCredentials: true
7679
allowMethods:
7780
- GET
7881
- POST
@@ -99,6 +102,7 @@ Alternatively, you can configure CORS using the Gateway API's `HTTPCORSFilter`.
99102
within an `HTTPRoute` resource, which is simpler if you only need to apply CORS to a specific route.
100103

101104
The below example applies CORS to the `backend` HTTPRoute, allowing requests from `http://*.foo.com`.
105+
It also enables credentialed requests with `allowCredentials: true`.
102106

103107
{{< tabpane text=true >}}
104108
{{% tab header="Apply from stdin" %}}
@@ -127,6 +131,7 @@ spec:
127131
cors:
128132
allowOrigins:
129133
- "http://*.foo.com"
134+
allowCredentials: true
130135
allowMethods:
131136
- GET
132137
- POST
@@ -167,6 +172,7 @@ spec:
167172
cors:
168173
allowOrigins:
169174
- "http://*.foo.com"
175+
allowCredentials: true
170176
allowMethods:
171177
- GET
172178
- POST
@@ -211,6 +217,7 @@ You should see the below response, indicating that the request from `http://www.
211217

212218
```shell
213219
< access-control-allow-origin: http://www.foo.com
220+
< access-control-allow-credentials: true
214221
< access-control-allow-methods: GET, POST
215222
< access-control-allow-headers: x-header-1, x-header-2
216223
< access-control-max-age: 86400

0 commit comments

Comments
 (0)