Skip to content

Commit

Permalink
docs(middleware/cors): fix ordering of how it works
Browse files Browse the repository at this point in the history
  • Loading branch information
sixcolors committed Mar 16, 2024
1 parent 81ddb4d commit 2e57b0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/api/middleware/cors.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ The `AllowOrigins` option controls which origins can make cross-origin requests.

In all cases above, except the **Wildcard origin**, the middleware will either add the `Access-Control-Allow-Origin` header to the response matching the origin of the incoming request, or it will not add the header at all if the origin is not allowed.

The `AllowMethods` option controls which HTTP methods are allowed. For example, if `AllowMethods` is set to `"GET, POST"`, the middleware adds the header `Access-Control-Allow-Methods: GET, POST` to the response.

- **Programmatic origin validation:**: The middleware also handles the `AllowOriginsFunc` option, which allows you to programmatically determine if an origin is allowed. If `AllowOriginsFunc` returns `true` for an origin, the middleware sets the `Access-Control-Allow-Origin` header to that origin.

The `AllowMethods` option controls which HTTP methods are allowed. For example, if `AllowMethods` is set to `"GET, POST"`, the middleware adds the header `Access-Control-Allow-Methods: GET, POST` to the response.

This way, the CORS middleware allows you to control how your Fiber application responds to cross-origin requests.

## Security Considerations
Expand Down

0 comments on commit 2e57b0b

Please sign in to comment.