可以配置是否在反向代理中添加X-Real-IP和X-Forwarded-*

This commit is contained in:
GoEdgeLab
2021-01-26 20:28:46 +08:00
parent cf8a1ce68a
commit 1b32a76294
3 changed files with 66 additions and 13 deletions

View File

@@ -498,18 +498,19 @@ func (x *UpdateReverseProxyBackupOriginsRequest) GetOriginsJSON() []byte {
return nil
}
// 修改是否启用
// 修改反向代理设置
type UpdateReverseProxyRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ReverseProxyId int64 `protobuf:"varint,1,opt,name=reverseProxyId,proto3" json:"reverseProxyId,omitempty"`
RequestHostType int32 `protobuf:"varint,6,opt,name=requestHostType,proto3" json:"requestHostType,omitempty"`
RequestHost string `protobuf:"bytes,2,opt,name=requestHost,proto3" json:"requestHost,omitempty"`
RequestURI string `protobuf:"bytes,3,opt,name=requestURI,proto3" json:"requestURI,omitempty"`
StripPrefix string `protobuf:"bytes,4,opt,name=stripPrefix,proto3" json:"stripPrefix,omitempty"`
AutoFlush bool `protobuf:"varint,5,opt,name=autoFlush,proto3" json:"autoFlush,omitempty"`
ReverseProxyId int64 `protobuf:"varint,1,opt,name=reverseProxyId,proto3" json:"reverseProxyId,omitempty"`
RequestHostType int32 `protobuf:"varint,6,opt,name=requestHostType,proto3" json:"requestHostType,omitempty"`
RequestHost string `protobuf:"bytes,2,opt,name=requestHost,proto3" json:"requestHost,omitempty"`
RequestURI string `protobuf:"bytes,3,opt,name=requestURI,proto3" json:"requestURI,omitempty"`
StripPrefix string `protobuf:"bytes,4,opt,name=stripPrefix,proto3" json:"stripPrefix,omitempty"`
AutoFlush bool `protobuf:"varint,5,opt,name=autoFlush,proto3" json:"autoFlush,omitempty"`
AddHeaders []string `protobuf:"bytes,7,rep,name=addHeaders,proto3" json:"addHeaders,omitempty"`
}
func (x *UpdateReverseProxyRequest) Reset() {
@@ -586,6 +587,13 @@ func (x *UpdateReverseProxyRequest) GetAutoFlush() bool {
return false
}
func (x *UpdateReverseProxyRequest) GetAddHeaders() []string {
if x != nil {
return x.AddHeaders
}
return nil
}
var File_service_reverse_proxy_proto protoreflect.FileDescriptor
var file_service_reverse_proxy_proto_rawDesc = []byte{
@@ -652,7 +660,7 @@ var file_service_reverse_proxy_proto_rawDesc = []byte{
0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x49, 0x64, 0x12, 0x20,
0x0a, 0x0b, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e,
0x22, 0xef, 0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72,
0x22, 0x8f, 0x02, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72,
0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26,
0x0a, 0x0e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50,
@@ -667,7 +675,9 @@ var file_service_reverse_proxy_proto_rawDesc = []byte{
0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x70, 0x50, 0x72,
0x65, 0x66, 0x69, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x6f, 0x46, 0x6c, 0x75, 0x73,
0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x75, 0x74, 0x6f, 0x46, 0x6c, 0x75,
0x73, 0x68, 0x32, 0xa2, 0x05, 0x0a, 0x13, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72,
0x73, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73,
0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x64, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65,
0x72, 0x73, 0x32, 0xa2, 0x05, 0x0a, 0x13, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72,
0x6f, 0x78, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x63, 0x72,
0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79,
0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65,
@@ -936,7 +946,7 @@ type ReverseProxyServiceClient interface {
UpdateReverseProxyPrimaryOrigins(ctx context.Context, in *UpdateReverseProxyPrimaryOriginsRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
// 修改备用源站信息
UpdateReverseProxyBackupOrigins(ctx context.Context, in *UpdateReverseProxyBackupOriginsRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
// 修改是否启用
// 修改反向代理设置
UpdateReverseProxy(ctx context.Context, in *UpdateReverseProxyRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
}
@@ -1025,7 +1035,7 @@ type ReverseProxyServiceServer interface {
UpdateReverseProxyPrimaryOrigins(context.Context, *UpdateReverseProxyPrimaryOriginsRequest) (*RPCSuccess, error)
// 修改备用源站信息
UpdateReverseProxyBackupOrigins(context.Context, *UpdateReverseProxyBackupOriginsRequest) (*RPCSuccess, error)
// 修改是否启用
// 修改反向代理设置
UpdateReverseProxy(context.Context, *UpdateReverseProxyRequest) (*RPCSuccess, error)
}