Support response headers for proxy type http (#151)

This commit is contained in:
Gerhard Tan
2024-05-09 11:24:10 +08:00
committed by GitHub
parent e1109e946f
commit 279f74180c
10 changed files with 667 additions and 616 deletions

View File

@ -215,6 +215,7 @@ type Proxy struct {
HTTPPwd string `ini:"http_pwd,omitempty" http:"true" tcpmux:"true"`
HostHeaderRewrite string `ini:"host_header_rewrite,omitempty" http:"true"`
Headers map[string]string `ini:"-" http:"true"`
ResponseHeaders map[string]string `ini:"-" http:"true"`
Multiplexer string `ini:"multiplexer,omitempty" tcpmux:"true"`
RouteByHTTPUser string `ini:"route_by_http_user,omitempty" http:"true" tcpmux:"true"`
// "kcp" or "quic"

View File

@ -117,6 +117,7 @@ func ClientProxyFromV1(pxyCfg TypedProxyConfig) *Proxy {
r.HostHeaderRewrite = v.HostHeaderRewrite
r.RouteByHTTPUser = v.RouteByHTTPUser
r.Headers = v.RequestHeaders.Set
r.ResponseHeaders = v.ResponseHeaders.Set
case *v1.HTTPSProxyConfig:
r.SubDomain = v.SubDomain
r.CustomDomains = strings.Join(v.CustomDomains, ",")
@ -383,6 +384,9 @@ func singleClientProxyToV1(p *Proxy) (TypedProxyConfig, error) {
RequestHeaders: v1.HeaderOperations{
Set: p.Headers,
},
ResponseHeaders: v1.HeaderOperations{
Set: p.ResponseHeaders,
},
RouteByHTTPUser: p.RouteByHTTPUser,
}
if p.CustomDomains != "" {