我删除了.php
应用程序中的文件附件,但这次应用程序的操作页面不起作用。因为我删除了.php
文件末尾的后缀。
例如,我想collect
使用 AJAX 将数据发送到文件,但得到 302 个返回。
https://panel.example.com/application/collect
应用程序的其他文件没有问题。
https://panel.example.com/login
*Version without rewrite:*
https://panel.example.com/index.php?cmd=login
如何修复应用程序工作文件中的 302 重定向问题?我哪里做错了?
location / {
try_files $uri $uri/ /index.php?$args;
}
rewrite ^/([^/]+)/([^/]+)?$ /index.php?cmd=$1&scd=$2 break;
rewrite ^/([^/]+)/?$ /index.php?cmd=$1 break;
上述代码不包含在完整配置文件。我已经上传了干净的文件。
通过 CMD 进行 CURL;
C:\Users\emres>curl -I https://panel.example.com/application/collect
HTTP/1.1 302 Found
Server: nginx/1.18.0
Date: Sun, 02 Jan 2022 12:32:57 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: PHPSESSID=pvn7l2g8babucp9a9mkuo5ll0v; path=/; domain=.example.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Access-Control-Max-Age: 86400
Access-Control-Allow-Credentials: true
Location: https://panel.example.com/login?returnBack=http://panel.example.com/application/collect
错误日志:
干净的。
访问日志:
192.168.1.145 - - [02/Jan/2022:15:36:22 +0300] "GET /application/collect HTTP/1.1" 302 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36 OPR/82.0.4227.33"
192.168.1.145 - - [02/Jan/2022:15:36:22 +0300] "GET /login?returnBack=https://panel.example.com/application/collect HTTP/1.1" 200 3977 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36 OPR/82.0.4227.33"
192.168.1.145 - - [02/Jan/2022:15:36:22 +0300] "GET /libs/out/general-js.php?v=61d19c464ab3b HTTP/1.1" 200 390 "https://panel.example.com/login?returnBack=https://panel.example.com/application/collect" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36 OPR/82.0.4227.33"
192.168.1.145 - - [02/Jan/2022:15:36:22 +0300] "POST /application/collect HTTP/1.1" 302 5 "https://panel.example.com/login?returnBack=https://panel.example.com/application/collect" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36 OPR/82.0.4227.33"
192.168.1.145 - - [02/Jan/2022:15:36:22 +0300] "GET /login?returnBackUnit=https://panel.example.com/application/collect HTTP/1.1" 200 3981 "https://panel.example.com/login?returnBack=https://panel.example.com/application/collect" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36 OPR/82.0.4227.33"
Nginx:1.18
我认为它以不同的方式检测“application/collect”路径。它将其检测为application
和cmd
index.php因为我可以访问此页面: - 但无法访问。我认为这影响了重写。collect
scd
https://panel.example.com/application/microServices/web
https://panel.example.com/application/collect