Http 请求被拒绝(未到达 Nginx)
问题现象
公司管理后台在调用 https://xxx/v2/cms/operation/notices/wm/temp/content 接口时,响应数据直接返回如下:
Response Headers
Cache-Control: no-cache
Connection: close
Content-Length: 247
Content-Type: text/html; charset=utf-8
Pragma: no-cache
<html>
<head>
<title>Request Rejected</title>
</head>
<body>The requested URL was rejected. Please consult with your administrator.
<br>
<br>Your support ID is: 10119285110654762291
<br>
<br>
<a href='javascript:history.back();'>[Go Back]</a>
</body>
</html>
问题查因
一般来说我们查看问题,会从 Nginx 入手,所以去查了 Nginx 日志,发现没有对应输出。那就说明这个请求没有到 Nginx。
最终定位原因:公司防火墙策略,将 temp作为关键字,拦截了对应请求导致。
解决方案
修改防火墙策略,不拦截 temp 关键字。
ps: 在设计接口时规范化,避免此类字符作为路由路径。