Docker Community Forums

Share and learn in the Docker community.

How to set up redirect uri for Facebook oauth authorization using dotnet core on docker when running behind IIS reverse proxy

(Yamackurtulus) #1

We are building a web application with dotnet core running inside docker containers. We have put the app behind IIS on WS2016 which is used as reverse proxy. The requests incoming to our URL ( are forwarded to the related docker container using the container name as the hostname with the help of url rewrite module(in our case, let’s call it “web”). This setup works up to here.

However, a few days ago we needed to add Facebook oauth authorization support to register to the system and a problem appeared. We setup our authorization as the following:

services.AddAuthentication().AddFacebook(o =>
    o.CallbackPath = new PathString("/account/facebookreturn");
    o.AppId = appSettings.FacebookLogin.AppId;
    o.AppSecret = appSettings.FacebookLogin.AppSecret;

Our facebook authentication challenge then redirects user to facebook oauth page with the following redirect uri:…redirect_uri=http%3A%2F%2Fweb%2Faccount%2Ffacebookreturn&state=…

As you see the redirect_uri has the container name / hostname of the docker container whereas it should actually be “”.

We tried several solutions such as using x-forwarded headers. Using UseIISIntegration() and UseUrls did not seem to work either. What are we missing here? I am not much experienced with IIS and web headers, so it could be fairly obvious, and I appreciate the help.


Were you able to find a solution to this?

(Yamackurtulus) #3

It’s been a while since I was last logged in here, sorry missed your reply. And yes, I have found a solution. I just need to refresh my memory, I will try to update as soon as possible.