前端請求 -> nginx -> centos(rabbitmq)前端
正常登陸 Rabbitmq Management 後,調用某些 url 包含 %2f 的接口時,後端返回:nginx
405 Method not allowed
後端
location /mq/ {
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_pass http://127.0.0.1:15672/;
}
正常訪問該地址:https://xxx.xxx.com/mq/ 時能正常跳轉,
可是 rabbitmq management 的 API url 出現了 %2f 字符,這些字符會在通過 nginx 被轉換爲/centos
location /mq/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
if ($request_uri ~* "/mq/(.*)"){
proxy_pass http://127.0.0.1:15672/$1;
break;
}
proxy_pass http://rabbitmq:15672/;
}
地址根據實際應用修改!url