Chi*_*rag 6 php database session proxy codeigniter
当您没有代理IP列表时会发生什么?使用Akamai,Google,Edgecast或CloudFront等网站加速服务时; 从他们那里获取会话的IP总是很难.
在CDN上测试我们的codeigniter应用程序时,我们注意到IP作为CDN IP而不是会话数据库中的客户端IP传递.
你怎么能绕过这个?
/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = '';
Run Code Online (Sandbox Code Playgroud)
谢谢!
小智 4
根据您使用的 Web 服务器,有些模块可以从 HTTP_X_FORWARDED_FOR 标头中为您提供真实的客户端 IP 地址,或者代理的等效地址。
我在 CloudFlare 后面的 Web 服务器上使用 Nginx,所以我使用这个: http: //wiki.nginx.org/HttpRealipModule
您需要为 Web 服务器配置模块,以便从 CDN 的正确标头获取真实客户端 IP。
| 归档时间: |
|
| 查看次数: |
3873 次 |
| 最近记录: |