Skip to content

Commit a6bd2f6

Browse files
committed
feat: add SSL verification option to website proxy configuration
1 parent 24d7dc0 commit a6bd2f6

14 files changed

Lines changed: 39 additions & 0 deletions

File tree

agent/app/dto/request/website.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ type WebsiteProxyConfig struct {
269269
Replaces map[string]string `json:"replaces"`
270270
SNI bool `json:"sni"`
271271
ProxySSLName string `json:"proxySSLName"`
272+
SSLVerify bool `json:"sslVerify"`
272273
CorsConfig
273274
}
274275

agent/app/service/website_proxy.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ func (w WebsiteService) OperateProxy(req request.WebsiteProxyConfig) (err error)
115115
return
116116
}
117117
applyLocationProxyPass(location, req.ProxyPass, &req.SNI, req.ProxySSLName)
118+
if isHTTPSProxyPass(req.ProxyPass) && req.SSLVerify {
119+
location.UpdateDirective("proxy_ssl_verify", []string{"on"})
120+
} else {
121+
location.RemoveDirective("proxy_ssl_verify", []string{})
122+
}
118123
location.UpdateDirective("proxy_set_header", []string{"Host", req.ProxyHost})
119124
location.ChangePath(req.Modifier, req.Match)
120125
// Server Cache Settings
@@ -329,6 +334,9 @@ func (w WebsiteService) GetProxies(id uint) (res []request.WebsiteProxyConfig, e
329334
if directive.GetName() == "proxy_ssl_name" && len(directive.GetParameters()) > 0 {
330335
proxyConfig.ProxySSLName = directive.GetParameters()[0]
331336
}
337+
if directive.GetName() == "proxy_ssl_verify" {
338+
proxyConfig.SSLVerify = len(directive.GetParameters()) > 0 && directive.GetParameters()[0] == "on"
339+
}
332340
}
333341
proxyConfig.Cors = location.Cors
334342
proxyConfig.AllowCredentials = location.AllowCredentials

frontend/src/api/interface/website.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ export namespace Website {
439439
proxyProtocol?: string;
440440
sni?: boolean;
441441
proxySSLName: string;
442+
sslVerify?: boolean;
442443
cors: boolean;
443444
allowOrigins: string;
444445
allowMethods: string;

frontend/src/lang/modules/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,8 @@ const message = {
27592759
sni: 'Origin SNI',
27602760
sniHelper:
27612761
"When the reverse proxy backend is HTTPS, you might need to set the origin SNI. See the CDN service provider's documentation for details.",
2762+
proxySslVerify: 'Verify Backend SSL Certificate',
2763+
proxySslVerifyHelper: 'When enabled, the proxy will strictly verify the upstream SSL certificate (disabled by default).',
27622764
huaweicloud: 'Huawei Cloud',
27632765
createDb: 'Create Database',
27642766
enableSSLHelper: 'Failure to enable will not affect the creation of the website',

frontend/src/lang/modules/es-es.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,6 +2794,8 @@ const message = {
27942794
sni: 'SNI de origen',
27952795
sniHelper:
27962796
'Cuando el backend proxy es HTTPS, puede ser necesario configurar el SNI. Consulta la doc del proveedor CDN.',
2797+
proxySslVerify: 'Verify Backend SSL Certificate',
2798+
proxySslVerifyHelper: 'When enabled, the proxy will strictly verify the upstream SSL certificate (disabled by default).',
27972799
huaweicloud: 'Huawei Cloud',
27982800
createDb: 'Crear base de datos',
27992801
enableSSLHelper: 'Si falla, no afectará la creación del sitio',

frontend/src/lang/modules/ja.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,6 +2781,8 @@ const message = {
27812781
sni: '起源は悲しい',
27822782
sniHelper:
27832783
'逆プロキシバックエンドがHTTPSの場合、Origin SNIを設定する必要がある場合があります。詳細については、CDNサービスプロバイダーのドキュメントを参照してください。',
2784+
proxySslVerify: 'Verify Backend SSL Certificate',
2785+
proxySslVerifyHelper: 'When enabled, the proxy will strictly verify the upstream SSL certificate (disabled by default).',
27842786
huaweicloud: 'huaweiCloud',
27852787
createDb: 'データベースを作成',
27862788
enableSSLHelper: 'SSLの有効化に失敗しても、ウェブサイトの作成には影響しません。',

frontend/src/lang/modules/ko.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,6 +2715,8 @@ const message = {
27152715
sni: '원본 SNI',
27162716
sniHelper:
27172717
'역방향 프록시 백엔드가 HTTPS 인 경우 원본 SNI 를 설정해야 할 수 있습니다. 자세한 내용은 CDN 서비스 제공자의 문서를 참조하세요.',
2718+
proxySslVerify: 'Verify Backend SSL Certificate',
2719+
proxySslVerifyHelper: 'When enabled, the proxy will strictly verify the upstream SSL certificate (disabled by default).',
27182720
huaweicloud: '화웨이 클라우드',
27192721
createDb: '데이터베이스 생성',
27202722
enableSSLHelper: 'SSL 활성화 실패는 웹사이트 생성에 영향을 미치지 않습니다.',

frontend/src/lang/modules/ms.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,6 +2811,8 @@ const message = {
28112811
sni: 'Sumber SNI',
28122812
sniHelper:
28132813
'Apabila backend proksi terbalik adalah HTTPS, anda mungkin perlu menetapkan sumber SNI. Sila rujuk dokumentasi penyedia perkhidmatan CDN untuk butiran.',
2814+
proxySslVerify: 'Verify Backend SSL Certificate',
2815+
proxySslVerifyHelper: 'When enabled, the proxy will strictly verify the upstream SSL certificate (disabled by default).',
28142816
huaweicloud: 'Huawei Cloud',
28152817
createDb: 'Cipta Pangkalan Data',
28162818
enableSSLHelper: 'Kegagalan mengaktifkan SSL tidak akan menjejaskan penciptaan laman web.',

frontend/src/lang/modules/pt-br.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,6 +2951,8 @@ const message = {
29512951
sni: 'SNI de origem',
29522952
sniHelper:
29532953
'Quando o proxy reverso de backend for HTTPS, você pode precisar configurar o SNI de origem. Consulte a documentação do provedor de serviços CDN para mais detalhes.',
2954+
proxySslVerify: 'Verify Backend SSL Certificate',
2955+
proxySslVerifyHelper: 'When enabled, the proxy will strictly verify the upstream SSL certificate (disabled by default).',
29542956
huaweicloud: 'Huawei Cloud',
29552957
createDb: 'Criar Banco de Dados',
29562958
enableSSLHelper: 'A falha ao ativar o SSL não afetará a criação do site.',

frontend/src/lang/modules/ru.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,6 +2811,8 @@ const message = {
28112811
sni: 'Origin SNI',
28122812
sniHelper:
28132813
'Когда бэкенд обратного прокси использует HTTPS, может потребоваться установить origin SNI. Подробности см. в документации провайдера CDN.',
2814+
proxySslVerify: 'Verify Backend SSL Certificate',
2815+
proxySslVerifyHelper: 'When enabled, the proxy will strictly verify the upstream SSL certificate (disabled by default).',
28142816
huaweicloud: 'Huawei Cloud',
28152817
rcreateDb: 'Создать Базу Данных',
28162818
enableSSLHelper: 'Неудача при включении SSL не повлияет на создание сайта.',

0 commit comments

Comments
 (0)