通过nginx转发rabbitmq访问手动添加队列的时候报错:Management API returned status code 405
原因:
正常访问该地址:https://xxx.xxx.com/rabbitmq/ 时能正常跳转,但是 rabbitmq management 的 API url 出现了 %2f 字符,这些字符会在经过 nginx 被转换为/
解决方案:
修改 nginx 配置文件
location ^~ /rabbitmq/ {
proxy_pass http://192.168.0.185:15672/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
if ($request_uri ~* "/rabbitmq/(.*)"){
proxy_pass http://192.168.0.185:15672/$1;
break;
}
}