【发布时间】:2017-01-04 08:45:13
【问题描述】:
我无法访问我网站的登录页面。它有 django-axes 访问日志中间件在监视它:
from axes.decorators import watch_login
@method_decorator(watch_login, name="dispatch")
class UserLogin(FormView): ...
对登录页面的 GET 请求会导致:
/path/to/login/ 处的数据错误
inet 类型的输入语法无效:“b''”
回溯中的IP地址(根据错误)是b'';所以我猜是nginx proxy is not passing this。
这是我的 nginx sites-available 配置的摘录(调试时我没有启用 ssl):
upstream app_servers {
server unix:/tmp/gunicorn.sock;
}
location / {
proxy_pass http://app_servers;
proxy_redirect off;
real_ip_header X-Real-IP;
proxy_set_header Host $http_host;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
我的 nginx 配置中缺少什么以使 django-axes 正常工作?
【问题讨论】: