Response header shows http and not https, login fails

I am using C#, Visual Studio, and Blazor server. My web app is running on https and I have the https redirect URIs in my Okta console (for both my web app address and localhost for testing). However, I am getting a redirect_uri error if the http version of my redirect uri is not in the list, and I get a 502 Gateway doesn’t exist error if it is in the list.

This behavior appears to be because the response header is expecting redirect_uri=http when it should be redirect_uri=https. The request uri and the request header both show https… so I am not sure why the response header is expecting http. My app runs just fine locally in Visual Studio in either https or http when I have https and http localhost uris in the redirect list in the Okta Dashboard. Does anyone have any insight?

Is there a way to manually define the redirect uri for the response header so I can force https. For example, something like:

https://…okta.com/oauth2/…redirect_uri=https…

instead of:

https://…okta.com/oauth2/…redirect_uri=http…

By the way, I am using Octopus to deploy my app in a Kubernetes container.