System.InvalidOperationException: The MetadataAddress or Authority must use HTTPS unless disabled for development by setting RequireHttpsMetadata=false. appears when options.Authority of the JWT bearer handler is an http:// address. Point it at the identity server's https:// address; only on a development machine with a local http identity server, set RequireHttpsMetadata = false.

The app starts without complaint. The exception comes with a request that goes through authentication, and the client gets a bare 500 with an empty body; in a rerun, two requests in a row both got that 500 and the console logged the exception twice. Look in the server console, not in the response.

The error

The response, from curl.exe -i:

curl.exe -i http://127.0.0.1:15605/patients -H "Authorization: Bearer $token"
HTTP/1.1 500 Internal Server Error
Content-Length: 0
Date: Sat, 14 Nov 2026 01:13:43 GMT
Server: Kestrel

The server console:

fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HNQ1TI3H07N4", Request id "0HNQ1TI3H07N4:00000001": An unhandled exception was thrown by the application.
      System.InvalidOperationException: The MetadataAddress or Authority must use HTTPS unless disabled for development by setting RequireHttpsMetadata=false.
         at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerPostConfigureOptions.PostConfigure(String name, JwtBearerOptions options)
...
         at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
...

Why it happens

Authority tells the handler where to download the identity server's metadata and signing keys. The test set it to http://127.0.0.1:15609 and left RequireHttpsMetadata at its default. The stack trace shows the check in JwtBearerPostConfigureOptions.PostConfigure, run when the authentication middleware asks for the options during a request; that is why the app starts and the requests fail. The message carries no IDX code, and the stack trace shows it thrown in the Microsoft.AspNetCore.Authentication.JwtBearer package itself.

The fix

In production, use the https address of your identity server as Authority. For a local http identity server during development only, the test's Program.cs switched the check off like this:

        var authority = builder.Configuration["Lab:Authority"];
        if (!string.IsNullOrEmpty(authority))
        {
            options.Authority = authority;
            if (builder.Configuration["Lab:RequireHttps"] == "false")
            {
                options.RequireHttpsMetadata = false;
            }
        }

The same request against an instance started with --Lab:RequireHttps=false on port 15604:

curl.exe -i http://127.0.0.1:15604/patients -H "Authorization: Bearer $token"
HTTP/1.1 200 OK
...
["Maria Garcia","David Chen"]

Nothing listened on 15609 in this test, and the request still got a 200. The test API also has its own IssuerSigningKey. Without a local key the same dead authority gives a 401 with IDX10500, described in its own post. Tie RequireHttpsMetadata = false to the Development environment so it cannot reach production.

How it was reproduced

A dotnet new web -f net10.0 API with Microsoft.AspNetCore.Authentication.JwtBearer 10.0.15 (Microsoft.IdentityModel 8.19.2) and one endpoint protected with RequireAuthorization(), on the ASP.NET Core 10.0.15 runtime, SDK 11.0.100. It ran on 127.0.0.1:15605 with --Lab:Authority=http://127.0.0.1:15609 (error) and on 15604 with the same authority plus --Lab:RequireHttps=false (fix). The token came from a console project on System.IdentityModel.Tokens.Jwt 8.19.2 with a made-up test key; requests went through curl 8.22.0 on Windows.

Frequently asked

Why does ASP.NET Core say the Authority must use HTTPS?
options.Authority was an http address and RequireHttpsMetadata was left at its default. In the test every authenticated request (two in a row) failed with a 500 and the exception was in the server console.
Is it safe to set RequireHttpsMetadata to false?
Only for a local development identity server. The message itself says the check can be disabled for development; keep the line behind an environment check so production keeps https.
Why does my API start fine and then return 500 with an empty body?
In the test the HTTPS check ran during the requests, inside the authentication middleware, not at start-up. The client saw an empty 500; the server console held the InvalidOperationException.

More decoded errors in the Fixes category. If the 500 is about a missing default scheme instead, see No authenticationScheme was specified.