# Authentication Callback url http:// when using Cloudflare

**URL:** <https://community.auth0.com/t/authentication-callback-url-http-when-using-cloudflare/77583>\
**Category:** Get Help\
**Tags:** csharp, nginx, dotnet-core, linux, auth0\
**Created:** [February 3, 2022, 11:17am UTC](https://community.auth0.com/t/authentication-callback-url-http-when-using-cloudflare/77583 "2022-02-03T11:17:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ffoliveira](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ffoliveira/32/34916_2.png) [@ffoliveira](https://community.auth0.com/u/ffoliveira)\
**Post date:** [February 3, 2022, 11:17am UTC](https://community.auth0.com/t/authentication-callback-url-http-when-using-cloudflare/77583/1 "2022-02-03T11:17:49Z")

</div>

Hello. I’m developing a new website using Dotnet Core in debian linux, proxying with nginx and configured with Cloudflare

the SDK is Auth0.AspNetCore.Authentication version 1.0.0  
dotnet version 6.0.101  
Debian 10

The authentication is working when I turn off proxy cache in Cloudflare DNS.  
When I turn it on, the url for login is

[https://XXXXX.us.auth0.com/authorize?client\_id=NHQSfWqF9s5byKEYKEY444F80&redirect\_uri=http%3A%2F%2Foligrid.net%2Fcallback&](https://XXXXX.us.auth0.com/authorize?client_id=NHQSfWqF9s5byKEYKEY444F80&redirect_uri=http%3A%2F%2Foligrid.net%2Fcallback&)…

The redirect\_uri turn HTTP when cache is on and HTTPS when off.

Do you have some tips to do here ?

Nginx proxy configuration for headers ?

the website is [https://oligrid.net](https://oligrid.net)

and the problem is I don’t want to callback in http://

---

<div class="post-metadata">

**Author:** ![PowerUnix](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/powerunix/32/35069_2.png) [@PowerUnix](https://community.auth0.com/u/PowerUnix)\
**Post date:** [February 8, 2022, 10:28pm UTC](https://community.auth0.com/t/authentication-callback-url-http-when-using-cloudflare/77583/2 "2022-02-08T22:28:03Z")

</div>

Maybe today you love me 💓  
It’s very easy just add in your nginx in location this line:

proxy\_set\_header Host [oligrid.net](http://oligrid.net)

Like the image **just add this line** (dont delete your configuration just add this line)

 ![Screenshot 2022-02-08 at 16-18-59 Hospedar ASP NET Core en Linux con Nginx](https://global.discourse-cdn.com/auth0/original/3X/3/1/3144d1d104b79e9ffbb26355c56795f5d3dd31b8.png)

---

<div class="post-metadata">

**Author:** ![PowerUnix](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/powerunix/32/35069_2.png) [@PowerUnix](https://community.auth0.com/u/PowerUnix)\
**Post date:** [February 8, 2022, 11:11pm UTC](https://community.auth0.com/t/authentication-callback-url-http-when-using-cloudflare/77583/3 "2022-02-08T23:11:04Z")

</div>

I forget and in your **setup.cs** add :

> services.Configure(options =\>  
> {  
> options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
> 
> });

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)  
**add**

> **app.UseForwardedHeaders();**

Like this configuration:

```auto
        public void ConfigureServices(IServiceCollection services)
        {
    
            services.ConfigureSameSiteNoneCookies();

            services.Configure<ForwardedHeadersOptions>(options =>
{
    options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;

});

            services.AddAuth0WebAppAuthentication(options =>
            {
                options.Domain = Configuration["Auth0:Domain"];
                options.ClientId = Configuration["Auth0:ClientId"];
            });

            services.AddControllersWithViews();
  
        }

  public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseForwardedHeaders();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseForwardedHeaders();
                app.UseHsts();
            }

            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

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

```

---

<div class="post-metadata">

**Author:** ![ffoliveira](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ffoliveira/32/34916_2.png) [@ffoliveira](https://community.auth0.com/u/ffoliveira)\
**Post date:** [February 9, 2022, 2:21am UTC](https://community.auth0.com/t/authentication-callback-url-http-when-using-cloudflare/77583/4 "2022-02-09T02:21:52Z")

</div>

Yes ! Thank you very much.  
Now it is working.

---

<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:** [February 9, 2022, 1:41pm UTC](https://community.auth0.com/t/authentication-callback-url-http-when-using-cloudflare/77583/5 "2022-02-09T13:41:32Z")

</div>

Wooohooo thanks for sharing it with the rest of community @PowerUnix !

---

<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:** [February 22, 2022, 2:28pm UTC](https://community.auth0.com/t/authentication-callback-url-http-when-using-cloudflare/77583/6 "2022-02-22T14:28:13Z")

</div>


