[反向代理]增加请求主机名类型选择

This commit is contained in:
GoEdgeLab
2020-11-30 22:28:08 +08:00
parent 8f5b5bd338
commit 776e1322ed
3 changed files with 78 additions and 57 deletions

View File

@@ -7,6 +7,14 @@ import (
"sync"
)
type RequestHostType = int8
const (
RequestHostTypeProxyServer RequestHostType = 0
RequestHostTypeOrigin RequestHostType = 1
RequestHostTypeCustomized RequestHostType = 2
)
// 反向代理设置
type ReverseProxyConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
@@ -17,9 +25,10 @@ type ReverseProxyConfig struct {
BackupOriginRefs []*OriginRef `yaml:"backupOriginRefs" json:"backupOriginRefs"` // 备用源站引用
Scheduling *SchedulingConfig `yaml:"scheduling" json:"scheduling"` // 调度算法选项
StripPrefix string `yaml:"stripPrefix" json:"stripPrefix"` // 去除URL前缀
RequestHost string `yaml:"requestHost" json:"requestHost"` // 请求Host,支持变量
RequestURI string `yaml:"requestURI" json:"requestURI"` // 请求URI,支持变量如果同时定义了StripPrefix则先执行StripPrefix
StripPrefix string `yaml:"stripPrefix" json:"stripPrefix"` // 去除URL前缀
RequestHostType RequestHostType `yaml:"requestHostType" json:"requestHostType"` // 请求Host类型
RequestHost string `yaml:"requestHost" json:"requestHost"` // 请求Host,支持变量
RequestURI string `yaml:"requestURI" json:"requestURI"` // 请求URI支持变量如果同时定义了StripPrefix则先执行StripPrefix
AutoFlush bool `yaml:"autoFlush" json:"autoFlush"` // 是否自动刷新缓冲区在比如SSEserver-sent events场景下很有用