mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-18 21:38:57 +08:00
fix: fix issue with http3 config not work in proxy website (#9183)
This commit is contained in:
parent
dd1d93e096
commit
060dd08167
2 changed files with 7 additions and 2 deletions
|
|
@ -985,7 +985,7 @@ func (w WebsiteService) OpWebsiteHTTPS(ctx context.Context, req request.WebsiteH
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err = ChangeHSTSConfig(req.Hsts, website); err != nil {
|
if err = ChangeHSTSConfig(req.Hsts, req.Http3, website); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
res.Enable = req.Enable
|
res.Enable = req.Enable
|
||||||
|
|
|
||||||
|
|
@ -1162,7 +1162,7 @@ func UpdateSSLConfig(websiteSSL model.WebsiteSSL) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ChangeHSTSConfig(enable bool, website model.Website) error {
|
func ChangeHSTSConfig(enable bool, http3Enable bool, website model.Website) error {
|
||||||
includeDir := GetSitePath(website, SiteProxyDir)
|
includeDir := GetSitePath(website, SiteProxyDir)
|
||||||
fileOp := files.NewFileOp()
|
fileOp := files.NewFileOp()
|
||||||
if !fileOp.Stat(includeDir) {
|
if !fileOp.Stat(includeDir) {
|
||||||
|
|
@ -1193,6 +1193,11 @@ func ChangeHSTSConfig(enable bool, website model.Website) error {
|
||||||
} else {
|
} else {
|
||||||
location.RemoveDirective("add_header", []string{"Strict-Transport-Security", "\"max-age=31536000\""})
|
location.RemoveDirective("add_header", []string{"Strict-Transport-Security", "\"max-age=31536000\""})
|
||||||
}
|
}
|
||||||
|
if http3Enable {
|
||||||
|
location.UpdateDirective("add_header", []string{"Alt-Svc", "'h3=\":443\"; ma=2592000'"})
|
||||||
|
} else {
|
||||||
|
location.RemoveDirective("add_header", []string{"Alt-Svc", "'h3=\":443\"; ma=2592000'"})
|
||||||
|
}
|
||||||
if err = nginx.WriteConfig(config, nginx.IndentedStyle); err != nil {
|
if err = nginx.WriteConfig(config, nginx.IndentedStyle); err != nil {
|
||||||
return buserr.WithErr("ErrUpdateBuWebsite", err)
|
return buserr.WithErr("ErrUpdateBuWebsite", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue