# Cannot authenticate Regular App using .NET Core SDK deployed in k8s behind reverse proxy with SSL termination

**URL:** <https://community.auth0.com/t/cannot-authenticate-regular-app-using-net-core-sdk-deployed-in-k8s-behind-reverse-proxy-with-ssl-termination/72991>\
**Category:** Get Help\
**Tags:** kubernetes, http, ssl\
**Created:** [November 11, 2021, 3:03pm UTC](https://community.auth0.com/t/cannot-authenticate-regular-app-using-net-core-sdk-deployed-in-k8s-behind-reverse-proxy-with-ssl-termination/72991 "2021-11-11T15:03:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![xtrmstep](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xtrmstep/32/32933_2.png) [@xtrmstep](https://community.auth0.com/u/xtrmstep)\
**Post date:** [November 11, 2021, 3:03pm UTC](https://community.auth0.com/t/cannot-authenticate-regular-app-using-net-core-sdk-deployed-in-k8s-behind-reverse-proxy-with-ssl-termination/72991/1 "2021-11-11T15:03:01Z")

</div>

Hi,

Let me explain the context before the question.

I’m using **[ASP.NET](http://ASP.NET) Core MVC SDK for regular app (latest version)**. I’m successfully authenticate on the local machine (running app from IDE, Rider) and using redirection to HTTPS. So that all works via HTTPS. When I try to configure and use locally HTTP, I cannot authenticate. I see the error:

 ![Exception: Correlation failed](https://global.discourse-cdn.com/auth0/original/3X/d/d/dd1f0c00f1c090ff8291a426e73090f5bca92b15.jpeg)  
We clearly see that when the app uses HTTPS it’s fine, and when HTTP it’s not.

We are deploying the app to k8s, behind ingress which terminates SSL. So that the app itself receives HTTP requests from the proxy, even we have HTTPS on internet. Here come the issue: the SDK thinks that it’s working with HTTP and produce the following symptoms:

- the SDK adds “redirect\_uri=http://…” and load Auth0 page with error: Callback URL mismatch.
- if we change manually http to https and continue, then I can login, but the error as mention above for HTTP is shown (Correlation failed)

Do I need to have a special configuration of ingress service in k8s for SDK to work? Where should we check the issue?  
Would be glad to any advices.

Thanks,

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 12, 2021, 9:33am UTC](https://community.auth0.com/t/cannot-authenticate-regular-app-using-net-core-sdk-deployed-in-k8s-behind-reverse-proxy-with-ssl-termination/72991/2 "2021-11-12T09:33:16Z")

</div>

Hey there!

Can I ask you to create a GitHub issue for that as it’s gonna be the most effective way of handling that directly with the SDK maintainers? Once you have a link to it you can share it here so we can ping them. Thank you!

---

<div class="post-metadata">

**Author:** ![xtrmstep](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xtrmstep/32/32933_2.png) [@xtrmstep](https://community.auth0.com/u/xtrmstep)\
**Post date:** [November 12, 2021, 10:45am UTC](https://community.auth0.com/t/cannot-authenticate-regular-app-using-net-core-sdk-deployed-in-k8s-behind-reverse-proxy-with-ssl-termination/72991/3 "2021-11-12T10:45:55Z")

</div>

Could you, please, advise in which repo should I create an issue? I see auth0-aspnet and [auth0.net](http://auth0.net). Could you, please, drop a link to correct GitHub repo?

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 12, 2021, 10:56am UTC](https://community.auth0.com/t/cannot-authenticate-regular-app-using-net-core-sdk-deployed-in-k8s-behind-reverse-proxy-with-ssl-termination/72991/4 "2021-11-12T10:56:17Z")

</div>

Sure go for this one:

> **[GitHub - auth0/auth0-aspnetcore-authentication: SDK for integrating Auth0 in...](https://github.com/auth0/auth0-aspnetcore-authentication)**
>
> SDK for integrating Auth0 in ASPNET Core. Contribute to auth0/auth0-aspnetcore-authentication development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![xtrmstep](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/xtrmstep/32/32933_2.png) [@xtrmstep](https://community.auth0.com/u/xtrmstep)\
**Post date:** [November 22, 2021, 9:21am UTC](https://community.auth0.com/t/cannot-authenticate-regular-app-using-net-core-sdk-deployed-in-k8s-behind-reverse-proxy-with-ssl-termination/72991/5 "2021-11-22T09:21:42Z")

</div>

We have found how to fix it.  
Before calling ChallengeAsync we are setting IsHttps to true.

```auto
HttpContext.Request.IsHttps = true;
await HttpContext.ChallengeAsync(Auth0Constants.AuthenticationScheme, authenticationProperties);

```

I think there is another approach which requires some special configuration of reverse proxy (nginx), but I’m not sure about it.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 22, 2021, 10:24am UTC](https://community.auth0.com/t/cannot-authenticate-regular-app-using-net-core-sdk-deployed-in-k8s-behind-reverse-proxy-with-ssl-termination/72991/6 "2021-11-22T10:24:27Z")

</div>

Thanks for sharing that with the rest of community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [November 25, 2021, 12:36pm UTC](https://community.auth0.com/t/cannot-authenticate-regular-app-using-net-core-sdk-deployed-in-k8s-behind-reverse-proxy-with-ssl-termination/72991/7 "2021-11-25T12:36:30Z")

</div>


