docs.php 支持nginx负载均衡

nignx 配置
----------
location / {
index index.php;
proxy_pass http://real_server;
}

proxy_set_header Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-HTTPS $scheme; #传递https值
------------------------
当请求是https的时候docs.php,生成的自动测试的url有错误:
api_desc_tpl.php
line:221 -> $url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) ? 'https://' : 'http://';
这个时候生成的Url: http://xxx.com:443
需要修改:
$url = ( (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']) || (isset($_SERVER['HTTP_X_HTTPS']) && $_SERVER['HTTP_X_HTTPS']) ) ? 'https://' : 'http://';
修改后生成的url 正确:
https://xxx.com:443
------
分享~~
已邀请:

要回复问题请先登录注册