Skip to content

Commit

Permalink
feat(system-security): Added 444 and 500 responses for unauthenticate…
Browse files Browse the repository at this point in the history
…d settings
  • Loading branch information
zhengkunwang223 committed Nov 21, 2024
1 parent 2ba17d8 commit 7540ce0
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 2 deletions.
16 changes: 16 additions & 0 deletions backend/constant/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ var WebUrlMap = map[string]struct{}{
"/websites/runtimes/python": {},

"/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{
Expand Down
5 changes: 5 additions & 0 deletions backend/init/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ func handleNoRoute(c *gin.Context) {
c.String(http.StatusInternalServerError, "Internal Server Error")
return
}
if resPage == "444" {
c.String(444, "")
return
}

file := fmt.Sprintf("html/%s.html", resPage)
if resPage == "200" && c.GetHeader("Accept-Language") == "en" {
file = "html/200_en.html"
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/res/html/500.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head><title>400 Bad Request</title></head>
<head><title>Internal Server Error</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center><h1>Internal Server Error</h1></center>
<hr><center>nginx</center>
</body>
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,8 @@ const message = {
error404: 'Not Found',
error408: 'Request Timeout',
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.',
certType: 'Certificate type',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1519,6 +1519,8 @@ const message = {
error404: '未找到',
error408: '請求超時',
error416: '無效請求',
error444: '關閉連線',
error500: '伺服器錯誤',

https: '為面板設置 https 協議訪問提升面板訪問安全性',
certType: '證書類型',
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,8 @@ const message = {
error404: '未找到',
error408: '请求超时',
error416: '无效请求',
error444: '关闭连接',
error500: '服务器错误',

https: '为面板设置 https 协议访问提升面板访问安全性',
certType: '证书类型',
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/views/setting/safe/response/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ const options = [
value: '416',
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 {
Expand Down

0 comments on commit 7540ce0

Please sign in to comment.