Skip to content

Commit 9303ee3

Browse files
authored
feat: Optimize HTTP to HTTPS redirection rules for non-443 port websites (#11761)
1 parent d64cb3d commit 9303ee3

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

agent/app/service/website_utils.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,17 @@ func applySSL(website *model.Website, websiteSSL model.WebsiteSSL, req request.W
849849
nginxParams[i].Params = []string{"ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL:!EXPORT:!DSS:!DES:!RC4:!3DES:!MD5:!PSK:!KRB5:!SRP:!CAMELLIA:!SEED"}
850850
}
851851
}
852+
if param.Name == "error_page" {
853+
if len(param.Params) < 2 {
854+
continue
855+
}
856+
code := param.Params[0]
857+
if code == "497" {
858+
if sslPort != 443 && param.Params[1] == "https://$host$request_uri" {
859+
param.Params[1] = fmt.Sprintf("https://$host:%d$request_uri", sslPort)
860+
}
861+
}
862+
}
852863
}
853864
if req.Hsts {
854865
var hstsValue string

0 commit comments

Comments
 (0)