首页
文档
问答
捐赠
源代码
商业产品
Swoole Tracker
Swoole Plus
Swoole Compiler
Swoole 微课程
商业合作
登录
注册
EN
全部
提问
分享
讨论
建议
公告
开发框架
发表新帖
关于nginx proxy_pass 问题
咸鱼大叔
去年
location /api/user/uproleinfo/ { proxy_http_version 1.1; proxy_redirect off; proxy_set_header Connection "keep-alive"; proxy_set_header X-Real-IP $remote_addr; proxy_send_timeout 60; proxy_read_timeout 3000; proxy_pass http://127.0.0.1:9502; } 请求http://xxx.com/api/user/uproleinfo 后 接收不到request数据 并且显示的是get方式 如果是直接请求http://127.0.0.1:9502 就完全正常 不知道 proxy_pass 错哪了了
评论
2020-03-11
鲁飞
你理解有问题。 不是访问`http://xxx.com/api/user/uproleinfo`就等于访问`http://127.0.0.1:9502`。 而是访问`http://xxx.com/api/user/uproleinfo`等于访问`http://127.0.0.1:9502/api/user/uproleinfo`。
点赞
0
回复
2020-03-11
咸鱼大叔
回复
鲁飞
[fd] => 1 [header] => Array ( [connection] => keep-alive [x-real-ip] => 120.230.114.71 [host] => 127.0.0.1:9502 [accept-encoding] => gzip [user-agent] => okhttp/3.9.0 [cache-control] => no-cache ) [server] => Array ( [request_method] => GET [request_uri] => / [path_info] => / [request_time] => 1583934049 [request_time_float] => 1583934049.6917 [server_protocol] => HTTP/1.1 [server_port] => 9502 [remote_port] => 4087 [remote_addr] => 127.0.0.1 [master_time] => 1583934048 ) [cookie] => [get] => [files] => [post] => [tmpfiles] => ) 这个是获得的数据 post get 都是空的
点赞
0
回复
2020-03-12
鲁飞
回复
咸鱼大叔
请提供复现代码,期望结果,实际结果。
点赞
0
回复
2020-03-12
咸鱼大叔
回复
鲁飞
swoole_set_process_name("swoole_http"); $http = new swoole_http_server("0.0.0.0", 9502); $http->set(['package_max_length' => 9000000000,]); $http->on("start", function ($server) { echo "Swoole http server is started at http://127.0.0.1:9502\n"; }); $http->on("request", function ($request, $response) { echo "OK"; print_r($request); }); $http->start();
点赞
0
回复
2020-03-12
咸鱼大叔
回复
鲁飞
安卓下 okhttp请求 http://xxx.com/api/user/uproleinfo 后 接收不到request数据 如果是直接请求http://127.0.0.1:9502 就完全正常 如果采用postman 请求 http://xxx.com/api/user/uproleinfo 都是能接受到的 感觉还是nginx转发的问题
点赞
0
回复
2020-03-12
鲁飞
我这里正常的,请求`http://127.0.0.1:9502/?a=111&b=222`或者代理后的域名加path,都有数据。
点赞
0
回复
2020-03-12
咸鱼大叔
问题已解决 谢谢 配置问题
点赞
0
回复