@@ -43,13 +43,19 @@ func (this *IndexAction) RunGet(params struct {
4343 }
4444 this .Data ["config" ] = config
4545
46+ var httpAllDomainMismatchActionCode = serverconfigs .DomainMismatchActionPage
4647 var httpAllDomainMismatchActionContentHTML string
4748 var httpAllDomainMismatchActionStatusCode = "404"
48- if config .HTTPAll .DomainMismatchAction != nil && config .HTTPAll .DomainMismatchAction .Options != nil {
49- httpAllDomainMismatchActionContentHTML = config .HTTPAll .DomainMismatchAction .Options .GetString ("contentHTML" )
50- var statusCode = config .HTTPAll .DomainMismatchAction .Options .GetInt ("statusCode" )
51- if statusCode > 0 {
52- httpAllDomainMismatchActionStatusCode = types .String (statusCode )
49+ if config .HTTPAll .DomainMismatchAction != nil {
50+ httpAllDomainMismatchActionCode = config .HTTPAll .DomainMismatchAction .Code
51+
52+ if config .HTTPAll .DomainMismatchAction .Options != nil {
53+ // 即使是非 page 处理动作,也读取这些内容,以便于在切换到 page 时,可以顺利读取到先前的设置
54+ httpAllDomainMismatchActionContentHTML = config .HTTPAll .DomainMismatchAction .Options .GetString ("contentHTML" )
55+ var statusCode = config .HTTPAll .DomainMismatchAction .Options .GetInt ("statusCode" )
56+ if statusCode > 0 {
57+ httpAllDomainMismatchActionStatusCode = types .String (statusCode )
58+ }
5359 }
5460 } else {
5561 httpAllDomainMismatchActionContentHTML = `<!DOCTYPE html>
@@ -73,6 +79,7 @@ p { color: grey; }
7379</html>`
7480 }
7581
82+ this .Data ["httpAllDomainMismatchActionCode" ] = httpAllDomainMismatchActionCode
7683 this .Data ["httpAllDomainMismatchActionContentHTML" ] = httpAllDomainMismatchActionContentHTML
7784 this .Data ["httpAllDomainMismatchActionStatusCode" ] = httpAllDomainMismatchActionStatusCode
7885
@@ -83,6 +90,7 @@ func (this *IndexAction) RunPost(params struct {
8390 ClusterId int64
8491
8592 HttpAllMatchDomainStrictly bool
93+ HttpAllDomainMismatchActionCode string
8694 HttpAllDomainMismatchActionContentHTML string
8795 HttpAllDomainMismatchActionStatusCode string
8896 HttpAllAllowMismatchDomainsJSON []byte
@@ -140,7 +148,7 @@ func (this *IndexAction) RunPost(params struct {
140148
141149 config .HTTPAll .MatchDomainStrictly = params .HttpAllMatchDomainStrictly
142150 config .HTTPAll .DomainMismatchAction = & serverconfigs.DomainMismatchAction {
143- Code : serverconfigs . DomainMismatchActionPage ,
151+ Code : params . HttpAllDomainMismatchActionCode ,
144152 Options : maps.Map {
145153 "statusCode" : domainMisMatchStatusCode ,
146154 "contentHTML" : params .HttpAllDomainMismatchActionContentHTML ,
0 commit comments