Authentication Nginx在每次POST请求时都要求输入密码
我用密码关闭了一个简单站点上的管理面板。当您登录时,它会要求您输入一次密码,我可以安全地浏览页面。但是,只要我想通过发送表单post请求来保存更改,Nginx就会再次请求密码。每一个帖子的请求都是如此Authentication Nginx在每次POST请求时都要求输入密码,authentication,nginx,Authentication,Nginx,我用密码关闭了一个简单站点上的管理面板。当您登录时,它会要求您输入一次密码,我可以安全地浏览页面。但是,只要我想通过发送表单post请求来保存更改,Nginx就会再次请求密码。每一个帖子的请求都是如此 server { server_name demo.app.ru; root /var/www/demo.app.ru/public_html; index index.html index.php; # Add trailing slash
server {
server_name demo.app.ru;
root /var/www/demo.app.ru/public_html;
index index.html index.php;
# Add trailing slash
rewrite ^([^.\?]*[^/])$ $1/ permanent;
# Remove repeating slashes
if ($request_uri ~ "^[^?]*?//") {
rewrite "^" $scheme://$host$uri permanent;
}
# Admin
location ^~ /admin/ {
try_files $uri $uri/ =404;
auth_basic "Administrator Login";
auth_basic_user_file /var/www/demo.app.ru/.htpasswd;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
我在网上寻找答案,但感觉只有我有这个问题。我发现了错误。原因是发送表单后重定向不正确,重定向到http而不是https。您的管理页面是什么/admin?您还可以在浏览器的“网络”选项卡中查看发起失败呼叫的原因:是提交的表单还是使用javascript发送的?@ptts,感谢您的评论,我发现了一个错误,这都是关于在保存数据后从https重定向到http。。。