首页
下载
文档
社区
视频
捐赠
源代码
赞助商
AOT 编译器
AI 助理
商业产品
PHP AOT 原生编译器
Swoole-Compiler 代码加密器
CRMEB 新零售社交电商系统
登录
注册
全部
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
发表新帖
关于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 错哪了了
发布于6年前 · 3 次浏览 · 来自
提问
咸鱼大叔
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 错哪了了
赞
0
收藏
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
登录
后参与评论
评论
2020-03-12
鲁飞
你理解有问题。 不是访问`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-12
咸鱼大叔
回复
鲁飞
[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
回复