# Okta redirect over https

**URL:** <https://devforum.okta.com/t/okta-redirect-over-https/11797>\
**Category:** Questions\
**Created:** [November 18, 2020, 11:55am UTC](https://devforum.okta.com/t/okta-redirect-over-https/11797 "2020-11-18T11:55:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandrews](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@sandrews](https://devforum.okta.com/u/sandrews)\
**Post date:** [November 18, 2020, 11:55am UTC](https://devforum.okta.com/t/okta-redirect-over-https/11797/1 "2020-11-18T11:55:39Z")

</div>

I have an [ASP.NET](http://ASP.NET) Core app running in a container over http with a load balancer/reverse proxy sitting in front of it configured to run over https. Everything is running within a VPC in AWS. The issue I have is that the redirect from Okta after authentication is over http not https: i.e.,

https://.okta.com/oauth2/default/v1/authorize?client\_id=XXXXX&redirect\_uri=http://

even though the original request was from https://

Not sure where the issue is here. Is it an Okta setting I missed, is it the load balancer or within the app although everything works fine over https with a self signed certificate when I run the app locally on my dev machine. Any help much appreciated.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [November 18, 2020, 7:27pm UTC](https://devforum.okta.com/t/okta-redirect-over-https/11797/2 "2020-11-18T19:27:08Z")

</div>

Is the redirect URI you’ve set in your app config set as `http://` or `https://`?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [November 18, 2020, 7:38pm UTC](https://devforum.okta.com/t/okta-redirect-over-https/11797/3 "2020-11-18T19:38:37Z")

</div>

Also, regarding having a reverse proxy in front of a .NET app, you may want to check out [this blog post](https://developer.okta.com/blog/2020/09/28/adapt-dotnet-app-for-samesite-fix).

---

<div class="post-metadata">

**Author:** ![sandrews](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@sandrews](https://devforum.okta.com/u/sandrews)\
**Post date:** [November 19, 2020, 10:24am UTC](https://devforum.okta.com/t/okta-redirect-over-https/11797/4 "2020-11-19T10:24:35Z")

</div>

It works over https when I run it locally on my machine and authenticates against my Okta https endpoint perfectly. It’s an [ASP.NET](http://ASP.NET) Core app…In the appsettings.json I’m using:

“Okta”: {  
“OktaDomain”: “[https://XXXX.okta.com/](https://XXXX.okta.com/)”,  
“ClientId”: “XXXXX”,  
“ClientSecret”: “XXXX”  
}

In startup.cs I’m using:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)  
{  
app.UseHttpsRedirection();  
app.UseStaticFiles();  
app.UseRouting();  
app.UseAuthentication();  
app.UseAuthorization();  
app.UseSession();  
app.UseEndpoints(endpoints =\>  
{  
endpoints.MapHealthChecks("/healthcheck");  
endpoints.MapControllers();  
endpoints.MapRazorPages();  
});  
}

---

<div class="post-metadata">

**Author:** ![sandrews](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@sandrews](https://devforum.okta.com/u/sandrews)\
**Post date:** [December 16, 2020, 1:23pm UTC](https://devforum.okta.com/t/okta-redirect-over-https/11797/5 "2020-12-16T13:23:28Z")

</div>

I’ve tried implementing the SameSite fix you mentioned in the post but after logging in to Okta it still redirects to http not https. I removed the http entry for the Okta Login redirect URIs just leaving the https entry and I get the Okta 400 error bad request? What is going on? Why does it redirect over http when the site is running over https. The site running in the Docker container is running over http. Any help much appreciated.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [December 16, 2020, 8:01pm UTC](https://devforum.okta.com/t/okta-redirect-over-https/11797/6 "2020-12-16T20:01:33Z")

</div>

Can you take a look at the answer in [this SO post](https://stackoverflow.com/a/50505373/14450392), about ensuring that your app is considering forwarded headers, as well as Microsoft’s article on [using .Net Core with a lb/proxy](https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-3.1), to see if these suggestions help?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 25, 2024, 11:50pm UTC](https://devforum.okta.com/t/okta-redirect-over-https/11797/7 "2024-01-25T23:50:23Z")

</div>

Closed on January 25, 2024, 11:50pm UTC


