[功能] 添加 origin_host 字段以覆盖回源请求的 Host 头

This commit is contained in:
ryan
2026-03-16 12:19:39 +08:00
parent ce08099de1
commit 4daf681eff
14 changed files with 152 additions and 27 deletions
+2
View File
@@ -6,6 +6,7 @@ type ProxyRoute struct {
ID uint `json:"id" gorm:"primaryKey"`
Domain string `json:"domain" gorm:"uniqueIndex;size:255;not null"`
OriginURL string `json:"origin_url" gorm:"size:2048;not null"`
OriginHost string `json:"origin_host" gorm:"size:255"`
Enabled bool `json:"enabled" gorm:"not null;default:true"`
EnableHTTPS bool `json:"enable_https" gorm:"column:enable_https;not null;default:false"`
CertID *uint `json:"cert_id"`
@@ -40,6 +41,7 @@ func (route *ProxyRoute) Update() error {
return DB.Model(&ProxyRoute{}).Where("id = ?", route.ID).Updates(map[string]any{
"domain": route.Domain,
"origin_url": route.OriginURL,
"origin_host": route.OriginHost,
"enabled": route.Enabled,
"enable_https": route.EnableHTTPS,
"cert_id": route.CertID,