|
@@ -13,6 +13,7 @@ import (
|
|
"imuslab.com/zoraxy/mod/dynamicproxy"
|
|
"imuslab.com/zoraxy/mod/dynamicproxy"
|
|
"imuslab.com/zoraxy/mod/dynamicproxy/loadbalance"
|
|
"imuslab.com/zoraxy/mod/dynamicproxy/loadbalance"
|
|
"imuslab.com/zoraxy/mod/dynamicproxy/permissionpolicy"
|
|
"imuslab.com/zoraxy/mod/dynamicproxy/permissionpolicy"
|
|
|
|
+ "imuslab.com/zoraxy/mod/dynamicproxy/rewrite"
|
|
"imuslab.com/zoraxy/mod/uptime"
|
|
"imuslab.com/zoraxy/mod/uptime"
|
|
"imuslab.com/zoraxy/mod/utils"
|
|
"imuslab.com/zoraxy/mod/utils"
|
|
)
|
|
)
|
|
@@ -332,7 +333,7 @@ func ReverseProxyHandleAddEndpoint(w http.ResponseWriter, r *http.Request) {
|
|
//VDir
|
|
//VDir
|
|
VirtualDirectories: []*dynamicproxy.VirtualDirectoryEndpoint{},
|
|
VirtualDirectories: []*dynamicproxy.VirtualDirectoryEndpoint{},
|
|
//Custom headers
|
|
//Custom headers
|
|
- UserDefinedHeaders: []*dynamicproxy.UserDefinedHeader{},
|
|
|
|
|
|
+ UserDefinedHeaders: []*rewrite.UserDefinedHeader{},
|
|
//Auth
|
|
//Auth
|
|
RequireBasicAuth: requireBasicAuth,
|
|
RequireBasicAuth: requireBasicAuth,
|
|
BasicAuthCredentials: basicAuthCredentials,
|
|
BasicAuthCredentials: basicAuthCredentials,
|
|
@@ -1127,7 +1128,7 @@ func HandleCustomHeaderList(w http.ResponseWriter, r *http.Request) {
|
|
//List all custom headers
|
|
//List all custom headers
|
|
customHeaderList := targetProxyEndpoint.UserDefinedHeaders
|
|
customHeaderList := targetProxyEndpoint.UserDefinedHeaders
|
|
if customHeaderList == nil {
|
|
if customHeaderList == nil {
|
|
- customHeaderList = []*dynamicproxy.UserDefinedHeader{}
|
|
|
|
|
|
+ customHeaderList = []*rewrite.UserDefinedHeader{}
|
|
}
|
|
}
|
|
js, _ := json.Marshal(customHeaderList)
|
|
js, _ := json.Marshal(customHeaderList)
|
|
utils.SendJSONResponse(w, string(js))
|
|
utils.SendJSONResponse(w, string(js))
|
|
@@ -1173,11 +1174,11 @@ func HandleCustomHeaderAdd(w http.ResponseWriter, r *http.Request) {
|
|
}
|
|
}
|
|
|
|
|
|
//Create a Custom Header Defination type
|
|
//Create a Custom Header Defination type
|
|
- var rewriteDirection dynamicproxy.HeaderDirection
|
|
|
|
|
|
+ var rewriteDirection rewrite.HeaderDirection
|
|
if direction == "toOrigin" {
|
|
if direction == "toOrigin" {
|
|
- rewriteDirection = dynamicproxy.HeaderDirection_ZoraxyToUpstream
|
|
|
|
|
|
+ rewriteDirection = rewrite.HeaderDirection_ZoraxyToUpstream
|
|
} else if direction == "toClient" {
|
|
} else if direction == "toClient" {
|
|
- rewriteDirection = dynamicproxy.HeaderDirection_ZoraxyToDownstream
|
|
|
|
|
|
+ rewriteDirection = rewrite.HeaderDirection_ZoraxyToDownstream
|
|
} else {
|
|
} else {
|
|
//Unknown direction
|
|
//Unknown direction
|
|
utils.SendErrorResponse(w, "header rewrite direction not supported")
|
|
utils.SendErrorResponse(w, "header rewrite direction not supported")
|
|
@@ -1188,7 +1189,7 @@ func HandleCustomHeaderAdd(w http.ResponseWriter, r *http.Request) {
|
|
if rewriteType == "remove" {
|
|
if rewriteType == "remove" {
|
|
isRemove = true
|
|
isRemove = true
|
|
}
|
|
}
|
|
- headerRewriteDefination := dynamicproxy.UserDefinedHeader{
|
|
|
|
|
|
+ headerRewriteDefination := rewrite.UserDefinedHeader{
|
|
Key: name,
|
|
Key: name,
|
|
Value: value,
|
|
Value: value,
|
|
Direction: rewriteDirection,
|
|
Direction: rewriteDirection,
|