title: ASP.NET MVC 5 + Owin + Facebook + Amazon ELB + Amazon CloudFront
body: <p>I am trying to use Owin to authenticate user with Facebook. Eveything is fine, but when I deploy the application on the Amazon EC2 with ELB, behind a CloudFront, the redirect url on Facebook callback is the ELB url, not the CloudFront url. </p>
  
  <p>For Example:</p>
  
  <p>1) I access the site by the CloudFront url and click in Logon: htp://MyCloudFrontDomain/Logon</p>
  
  <p>2) I click on the Facebook logon button and I am redirect to <a href="https://www.facebook.com/dialog/oauth?response_type=code&amp;client_id=123&amp;redirect_uri=http%3A%2F%2FapplicationLoadBalancer" rel="nofollow">https://www.facebook.com/dialog/oauth?response_type=code&amp;client_id=123&amp;redirect_uri=http%3A%2F%2FapplicationLoadBalancer</a>...</p>
  
  <p>I am using the folowing code: <a href="https://github.com/Code-Inside/Samples/blob/master/2013/OwinKatanaAndOneAspNet/Auth/Controllers/AccountController.cs" rel="nofollow">https://github.com/Code-Inside/Samples/blob/master/2013/OwinKatanaAndOneAspNet/Auth/Controllers/AccountController.cs</a> (see ChallengeResult class)</p>
  
  <p>Anyone have an idea that why the Owin generate the ELB url and not the one that I first access the site (CloudFront url)?</p>