我正在使用bottlepy @port 80,现在我已经安装了NGINX,并配置了这个选项:
(...)
listen 443 default_server;
listen [::]:443 default_server;
server_name _;
root /usr/share/nginx/html;
ssl on;
ssl_certificate /xxx/xxx/xxx.crt;
ssl_certificate_key /xxx/xxx/xxx.key;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
proxy_pass http://localhost:80;
proxy_set_header Host $proxy_host;
#proxy_set_header Host $REMOTE_ADDR;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
(...)
但在Bottle LOG中,现在所有请求都来自127.0.0.1。
示例:
May 25 18:11:02 servername processd: 127.0.0.1 - - [2016-05-25 18:11:02] "GET /info HTTP/1.0" 200 187 0.007680
有人可以帮助我吗?
由于
答案 0 :(得分:0)
您是否尝试过:request.environ.get('HTTP_X_FORWARDED_FOR')