Ghost博客,HTTP身份验证,nginx和firefox

时间:2015-04-08 17:01:21

标签: firefox authentication nginx ghost-blog

我有一个运行Nginx代理的幽灵博客,我想为博客启用http身份验证。我的nginx .conf文件中有以下服务器{}块:

listen 80;
listen [::]:80;

server_name docs.example.com; 

root /usr/share/nginx/html;
index index.html index.htm;

client_max_body_size 10G;

auth_basic  "closed website";
auth_basic_user_file /etc/nginx/htpasswd;

location / {
    proxy_pass http://localhost:2777;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffering off;
}

此配置在登录时在ghost管理界面的登录页面创建了一个无限重定向循环。这是firefox控制台日志:

GET  http://docs.my-site.com/ghost/api/v0.1/users/me/?status=all&include=roles 

401 Unauthorized
{"type":"error","message":"Please Sign In","status":"passive"}

无论如何,似乎所有我要做的就是禁用auth_basic for location / ghost /我会很高兴:

location /ghost/ {
    auth_basic  off;
    proxy_pass http://localhost:2777;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffering off;
}

我将此块添加到.conf文件中,不幸的是,如果我在主页上进行身份验证后尝试登录,则仍会出现重定向循环。如果我转到Firefox的历史记录菜单,清除登录凭据并直接导航管理员登录窗格,我可以登录。我们到达某个地方并不是很好。这是奇怪的部分。按照此过程并登录后,Firefox会提示我身份验证提示“Restricted”。我可以点击取消并与管理界面上的设置和菜单进行交互就好了。但到底是怎么回事?

仍然在修补,如果我取得任何进展,我会发布更新。任何关于如何使这项工作的想法将不胜感激。提前谢谢。

更新

Chrome中的流程不那么多 - 没有无限的重定向循环。登录管理界面后仍然会获得凭据提示。

0 个答案:

没有答案