【问题标题】:Facebook oauth authentication is redirecting to localhost instead of to my domainFacebook oauth 身份验证重定向到本地主机而不是我的域
【发布时间】:2013-05-11 05:47:17
【问题描述】:

通过 OAuth 进行身份验证时,Facebook 重定向到 localhost 而不是我的域。我正在使用 django-allauth 进行 facebook 身份验证。有人at GitHub 指出错误可能出在 Nginx 配置中。我在下面粘贴我的 nginx 配置:

<pre></pre>

server { # simple reverse-proxy
    listen       80;
    server_name  subdomain.domain.com;
    access_log   logs/site.access.log;

    # serve static files
    location ~ ^/static/  {
        root    /home/user_name/site_assets/;
        expires 30d;
    }

    # serve media files
    location ~ ^/media/(images|javascript|js|css|flash|img)/  {
        root    /home/user_name/site_assets/;
        expires 30d;
    }

    # pass requests for dynamic content to rails/turbogears/zope, et al
    location / {
        proxy_pass      http://localhost:8000;    
    }
  }

有人可以澄清一下我在这里遗漏了什么吗?

【问题讨论】:

    标签: nginx facebook-oauth django-allauth


    【解决方案1】:

    经过一番折腾,终于找到了。 Nginx 配置应该有这个额外的行。 proxy_set_header Host $http_host; 所以最终的 Nginx 配置应该是这样的:

    <pre></pre>

    server { # simple reverse-proxy
        listen       80;
        server_name  subdomain.domain.com;
        access_log   logs/site.access.log;
    
        # serve static files
        location ~ ^/static/  {
            root    /home/user_name/site_assets/;
            expires 30d;
        }
    
        # serve media files
        location ~ ^/media/(images|javascript|js|css|flash|img)/  {
            root    /home/user_name/site_assets/;
            expires 30d;
        }
    
        # pass requests for dynamic content to rails/turbogears/zope, et al
        location / {
            proxy_set_header Host $http_host;
            proxy_pass      http://localhost:8000;    
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-12
      • 1970-01-01
      • 1970-01-01
      • 2021-07-07
      • 1970-01-01
      • 2011-09-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多