diff --git a/backend/app/dto/request/website.go b/backend/app/dto/request/website.go index 2082e1221..1929b7ca7 100644 --- a/backend/app/dto/request/website.go +++ b/backend/app/dto/request/website.go @@ -189,6 +189,7 @@ type WebsiteProxyConfig struct { Content string `json:"content"` FilePath string `json:"filePath"` Replaces map[string]string `json:"replaces"` + SNI bool `json:"sni"` } type WebsiteProxyReq struct { diff --git a/backend/app/service/website.go b/backend/app/service/website.go index e0d40115e..a30eb1cee 100644 --- a/backend/app/service/website.go +++ b/backend/app/service/website.go @@ -1643,6 +1643,11 @@ func (w WebsiteService) OperateProxy(req request.WebsiteProxyConfig) (err error) } else { location.RemoveSubFilter() } + if req.SNI { + location.UpdateDirective("proxy_ssl_server_name", []string{"on"}) + } else { + location.UpdateDirective("proxy_ssl_server_name", []string{"off"}) + } if err = nginx.WriteConfig(config, nginx.IndentedStyle); err != nil { return buserr.WithErr(constant.ErrUpdateBuWebsite, err) } @@ -1718,6 +1723,11 @@ func (w WebsiteService) GetProxies(id uint) (res []request.WebsiteProxyConfig, e proxyConfig.Modifier = location.Modifier proxyConfig.ProxyHost = location.Host proxyConfig.Replaces = location.Replaces + for _, directive := range location.Directives { + if directive.GetName() == "proxy_ssl_server_name" { + proxyConfig.SNI = directive.GetParameters()[0] == "on" + } + } res = append(res, proxyConfig) } return diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 96adfc7ae..b4fc0e698 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -2092,6 +2092,9 @@ const message = { indexPHP: 'PHP website default page', sslExpireDate: 'Certificate Expiry Date', website404Helper: 'Website 404 error page only supports PHP runtime environment websites and static websites', + sni: 'Origin SNI', + sniHelper: + "When the reverse proxy backend is HTTPS, you might need to set the origin SNI. Please refer to the CDN service provider's documentation for details.", }, php: { short_open_tag: 'Short tag support', @@ -2336,7 +2339,11 @@ const message = { customScriptHelper: 'Please fill in the complete startup command, for example: npm run start', portError: 'Cannot fill in the same port', systemRestartHelper: 'Status description: Interruption - status acquisition failed due to system restart', - javaScriptHelper: 'Please fill in the complete startup command, for example: java -jar halo.jar', + javaScriptHelper: + 'Please fill in the complete startup command, for example: java -jar halo.jar -Xmx1024M -Xms256M', + javaDirHelper: 'The directory must contain jar files, subdirectories are also acceptable', + goHelper: 'Please provide a complete start command, for example: go run main.go or ./main', + goDirHelper: 'The directory must contain go files or binary files, subdirectories are also acceptable', }, process: { pid: 'Process ID', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 5c8f21f66..f595383a6 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1948,6 +1948,8 @@ const message = { indexPHP: 'PHP 網站預設頁', sslExpireDate: '憑證過期時間', website404Helper: '網站 404 錯誤頁僅支援 PHP 運行環境網站和靜態網站', + sni: '回源 SNI', + sniHelper: '反代後端為 https 的時候可能需要設置回源 SNI,具體需要看 CDN 服務商文檔', }, php: { short_open_tag: '短標簽支持', @@ -2170,7 +2172,10 @@ const message = { customScriptHelper: '請填寫完整的啟動指令,例如:npm run start', portError: '不能填寫相同連接埠', systemRestartHelper: '狀態說明:中斷-系統重新啟動導致狀態取得失敗', - javaScriptHelper: '請填寫完整啟動指令,例如:java -jar halo.jar', + javaScriptHelper: '請填寫完整啟動指令,例如:java -jar halo.jar -Xmx1024M -Xms256M', + javaDirHelper: '目錄中要包含 jar 包,子目錄中包含也可', + goHelper: '請填寫完整啟動命令,例如:go run main.go 或 ./main', + goDirHelper: '目錄中要包含 go 文件或者二進制文件,子目錄中包含也可', }, process: { pid: '進程ID', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index f8b4dcdab..ab9cad7c8 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1949,6 +1949,8 @@ const message = { indexPHP: 'PHP 网站默认页', sslExpireDate: '证书过期时间', website404Helper: '网站 404 错误页仅支持 PHP 运行环境网站和静态网站', + sni: '回源 SNI', + sniHelper: '反代后端为 https 的时候可能需要设置回源 SNI,具体需要看 CDN 服务商文档', }, php: { short_open_tag: '短标签支持', @@ -2172,7 +2174,10 @@ const message = { customScriptHelper: '请填写完整的启动命令,例如:npm run start', portError: '不能填写相同端口', systemRestartHelper: '状态说明:中断-系统重启导致状态获取失败', - javaScriptHelper: '请填写完整启动命令,例如:java -jar halo.jar', + javaScriptHelper: '请填写完整启动命令,例如:java -jar halo.jar -Xmx1024M -Xms256M', + javaDirHelper: '目录中要包含 jar 包,子目录中包含也可', + goHelper: '请填写完整启动命令,例如:go run main.go 或 ./main', + goDirHelper: '目录中要包含 go 文件或者二进制文件,子目录中包含也可', }, process: { pid: '进程ID', diff --git a/frontend/src/views/website/runtime/go/operate/index.vue b/frontend/src/views/website/runtime/go/operate/index.vue index 2c1bdc96f..3a36d03bf 100644 --- a/frontend/src/views/website/runtime/go/operate/index.vue +++ b/frontend/src/views/website/runtime/go/operate/index.vue @@ -55,7 +55,7 @@ - + + + {{ $t('runtime.goDirHelper') }} + - {{ $t('runtime.customScriptHelper') }} + {{ $t('runtime.goHelper') }} diff --git a/frontend/src/views/website/runtime/java/operate/index.vue b/frontend/src/views/website/runtime/java/operate/index.vue index 5f5a318bd..86dd391fa 100644 --- a/frontend/src/views/website/runtime/java/operate/index.vue +++ b/frontend/src/views/website/runtime/java/operate/index.vue @@ -55,7 +55,7 @@ - + + + {{ $t('runtime.javaDirHelper') }} + - {{ $t('runtime.customScriptHelper') }} + {{ $t('runtime.javaScriptHelper') }} diff --git a/frontend/src/views/website/website/config/basic/proxy/create/index.vue b/frontend/src/views/website/website/config/basic/proxy/create/index.vue index 0521ce69f..407afcdb9 100644 --- a/frontend/src/views/website/website/config/basic/proxy/create/index.vue +++ b/frontend/src/views/website/website/config/basic/proxy/create/index.vue @@ -27,6 +27,10 @@ + + + {{ $t('website.sniHelper') }} +