Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UseCors must come before UseHttpsRedirection #19957

Closed
naramdash opened this issue Sep 22, 2020 · 2 comments
Closed

UseCors must come before UseHttpsRedirection #19957

naramdash opened this issue Sep 22, 2020 · 2 comments

Comments

@naramdash
Copy link

naramdash commented Sep 22, 2020

Issue description

when using Cors middleware, it comes before UseHttpsRedirection.
if not, Cors middleware doesn't work

Software versions

  • [v] .NET Core 3.1 WebApi

on Startup.cs

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseCors();

            app.UseHttpsRedirection(); // after UseCors();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }

Document Details

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants