mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
Merge pull request #6359 from guggero/fix-rest-proxy-fallback
lnd: disable REST proxy HTTP method fallback
This commit is contained in:
commit
bd5e29ec83
13
docs/release-notes/release-notes-0.14.3.md
Normal file
13
docs/release-notes/release-notes-0.14.3.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Release Notes
|
||||
|
||||
## Bug fixes
|
||||
|
||||
* The REST proxy (`grpc-gateway` library) had a fallback that redirected `POST`
|
||||
requests to another endpoint _with the same URI_ if no endpoint for `POST` was
|
||||
registered. [This default behavior was turned
|
||||
off](https://github.com/lightningnetwork/lnd/pull/6359), enabling strict
|
||||
HTTP method matching.
|
||||
|
||||
# Contributors (Alphabetical Order)
|
||||
|
||||
* Oliver Gugger
|
11
lnd.go
11
lnd.go
@ -973,7 +973,16 @@ func startRestProxy(cfg *Config, rpcServer *rpcServer, restDialOpts []grpc.DialO
|
||||
},
|
||||
},
|
||||
)
|
||||
mux := proxy.NewServeMux(customMarshalerOption)
|
||||
mux := proxy.NewServeMux(
|
||||
customMarshalerOption,
|
||||
|
||||
// Don't allow falling back to other HTTP methods, we want exact
|
||||
// matches only. The actual method to be used can be overwritten
|
||||
// by setting X-HTTP-Method-Override so there should be no
|
||||
// reason for not specifying the correct method in the first
|
||||
// place.
|
||||
proxy.WithDisablePathLengthFallback(),
|
||||
)
|
||||
|
||||
// Register our services with the REST proxy.
|
||||
err := lnrpc.RegisterStateHandlerFromEndpoint(
|
||||
|
Loading…
Reference in New Issue
Block a user