Cors and UseStaicFiles order /3 (#25490)

* Cors and UseStaicFiles order /3

* Cors and UseStaicFiles order /3

* Cors and UseStaicFiles order /3
pull/25500/head
Rick Anderson 2022-04-04 08:00:34 -10:00 committed by GitHub
parent 2b9bdd4cf9
commit 07fec89d7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -181,6 +181,10 @@ app.MapRazorPages();
For information about Single Page Applications, see the guides for the [React](xref:spa/react) and [Angular](xref:spa/angular) project templates.
## UseCors and UseStaticFiles order
The order for calling `UseCors` and `UseStaticFiles` depends on the app. For more information, see [UseCors and UseStaticFiles order](xref:security/cors#uc1)
### Forwarded Headers Middleware order
[!INCLUDE[](~/includes/ForwardedHeaders.md)]

View File

@ -90,6 +90,12 @@ The <xref:Microsoft.AspNetCore.Cors.Infrastructure.CorsPolicyBuilder> methods ca
Note: The specified URL must **not** contain a trailing slash (`/`). If the URL terminates with `/`, the comparison returns `false` and no header is returned.
<a name="uc1"></a>
## UseCors and UseStaticFiles order
Typically, `UseStaticFiles` is called before `UseCors`. Apps that use JavaScript to retrieve static files cross site must call `UseCors` before `UseStaticFiles`.
<a name="dp"></a>
### CORS with default policy and middleware