Skip to content

Commit cb80489

Browse files
committed
rpc_proxy: always allow Proxy calls
1 parent 96779c9 commit cb80489

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

rpc_proxy.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,8 @@ func (p *rpcProxy) convertSuperMacaroon(ctx context.Context, macHex string,
609609
// checkSubSystemStarted checks if the subsystem responsible for handling the
610610
// given URI has started.
611611
func (p *rpcProxy) checkSubSystemStarted(requestURI string) error {
612-
// A request to Lit's status server is always allowed.
613-
if isStatusReq(requestURI) {
612+
// A request to Lit's status and proxy services is always allowed.
613+
if isStatusReq(requestURI) || isProxyReq(requestURI) {
614614
return nil
615615
}
616616

@@ -630,7 +630,7 @@ func (p *rpcProxy) checkSubSystemStarted(requestURI string) error {
630630
system = subservers.LND
631631

632632
default:
633-
return fmt.Errorf("unknown gRPC web request: %v", requestURI)
633+
return ErrUnknownRequest
634634
}
635635

636636
// Check with the status manger to see if the sub-server is ready to
@@ -686,3 +686,11 @@ func isStatusReq(uri string) bool {
686686
uri, fmt.Sprintf("/%s", litrpc.Status_ServiceDesc.ServiceName),
687687
)
688688
}
689+
690+
// isProxyReq returns true if the given request is intended for the litrpc.Proxy
691+
// service.
692+
func isProxyReq(uri string) bool {
693+
return strings.HasPrefix(
694+
uri, fmt.Sprintf("/%s", litrpc.Proxy_ServiceDesc.ServiceName),
695+
)
696+
}

0 commit comments

Comments
 (0)