Commit 0aaedc4
authored
CORS origins of an array of one are made a scalar. (#1536)
The access-control-allowed-origins CORS header only allows
a single origin or "*" as its response. To support multiple origins,
the cors middleware makes this header dynamic based on the origin
header of the request when the middleware is configured with anything
but a single string.
To help avoid a few edge cases customers may encounter, we can unwrap
an array of one element into a scalar to encourage the cors middleware
to make the access-control-allowed-origin header static.
As a very minor performance boost, this change also instantiates the
cors middleware once and uses it on all requests rather than
constructing it dynamically within a request.1 parent 3d8d595 commit 0aaedc4
1 file changed
+15
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
268 | 275 | | |
269 | 276 | | |
270 | 277 | | |
271 | 278 | | |
272 | 279 | | |
273 | | - | |
| 280 | + | |
274 | 281 | | |
275 | 282 | | |
276 | 283 | | |
| |||
363 | 370 | | |
364 | 371 | | |
365 | 372 | | |
366 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
367 | 380 | | |
368 | 381 | | |
369 | 382 | | |
| |||
0 commit comments