I wasn't able to get antiforgery headers working while placing the code app.Use(next => context => as the first piece of middleware. It worked after placing just before app.UseMvc(...
Edit: Add RP samples

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I wasn't able to get antiforgery headers working while placing the code
app.Use(next => context =>as the first piece of middleware. It worked after placing just beforeapp.UseMvc(...Edit: Add RP samples

Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.