feat(system-security): Added 444 and 500 responses for unauthenticated settings (#7143)

This commit is contained in:
zhengkunwang 2024-11-21 17:46:13 +08:00 committed by GitHub
parent a8aa1f87f2
commit c2fd02ac48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 37 additions and 2 deletions

View File

@ -99,6 +99,22 @@ var WebUrlMap = map[string]struct{}{
"/websites/runtimes/python": {}, "/websites/runtimes/python": {},
"/login": {}, "/login": {},
"/xpack": {},
"/xpack/waf/dashboard": {},
"/xpack/waf/global": {},
"/xpack/waf/websites": {},
"/xpack/waf/log": {},
"/xpack/waf/block": {},
"/xpack/monitor/dashboard": {},
"/xpack/monitor/setting": {},
"/xpack/monitor/rank": {},
"/xpack/monitor/log": {},
"/xpack/tamper": {},
"/xpack/gpu": {},
"/xpack/alert/dashboard": {},
"/xpack/alert/log": {},
"/xpack/setting": {},
} }
var DynamicRoutes = []string{ var DynamicRoutes = []string{

View File

@ -90,6 +90,11 @@ func handleNoRoute(c *gin.Context) {
c.String(http.StatusInternalServerError, "Internal Server Error") c.String(http.StatusInternalServerError, "Internal Server Error")
return return
} }
if resPage == "444" {
c.String(444, "")
return
}
file := fmt.Sprintf("html/%s.html", resPage) file := fmt.Sprintf("html/%s.html", resPage)
if resPage == "200" && c.GetHeader("Accept-Language") == "en" { if resPage == "200" && c.GetHeader("Accept-Language") == "en" {
file = "html/200_en.html" file = "html/200_en.html"

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head><title>400 Bad Request</title></head> <head><title>Internal Server Error</title></head>
<body> <body>
<center><h1>400 Bad Request</h1></center> <center><h1>Internal Server Error</h1></center>
<hr><center>nginx</center> <hr><center>nginx</center>
</body> </body>

View File

@ -1586,6 +1586,8 @@ const message = {
error404: 'Not Found', error404: 'Not Found',
error408: 'Request Timeout', error408: 'Request Timeout',
error416: 'Range Not Satisfiable', error416: 'Range Not Satisfiable',
error444: 'Connection closed',
error500: 'Server error',
https: 'Setting up HTTPS protocol access for the panel can enhance the security of panel access.', https: 'Setting up HTTPS protocol access for the panel can enhance the security of panel access.',
certType: 'Certificate type', certType: 'Certificate type',

View File

@ -1519,6 +1519,8 @@ const message = {
error404: '未找到', error404: '未找到',
error408: '請求超時', error408: '請求超時',
error416: '無效請求', error416: '無效請求',
error444: '關閉連線',
error500: '伺服器錯誤',
https: '為面板設置 https 協議訪問提升面板訪問安全性', https: '為面板設置 https 協議訪問提升面板訪問安全性',
certType: '證書類型', certType: '證書類型',

View File

@ -1520,6 +1520,8 @@ const message = {
error404: '未找到', error404: '未找到',
error408: '请求超时', error408: '请求超时',
error416: '无效请求', error416: '无效请求',
error444: '关闭连接',
error500: '服务器错误',
https: '为面板设置 https 协议访问提升面板访问安全性', https: '为面板设置 https 协议访问提升面板访问安全性',
certType: '证书类型', certType: '证书类型',

View File

@ -90,6 +90,14 @@ const options = [
value: '416', value: '416',
label: '416 - ' + i18n.global.t('setting.error416'), label: '416 - ' + i18n.global.t('setting.error416'),
}, },
{
value: '444',
label: '444 - ' + i18n.global.t('setting.error444'),
},
{
value: '500',
label: '500 - ' + i18n.global.t('setting.error500'),
},
]; ];
interface DialogProps { interface DialogProps {