Resgate may stop on HTTP requests
Closed this issue · 0 comments
jirenius commented
Issue
If HTTP requests are sent with URL:s that are translated into invalid NATS subjects, NATS will disconnect Resgate, which in turn responds by stopping.
Most common is using trailing slash:
/api/service/model/
Which translates into the invalid subject:
service.model.
Solution
Tighten up the validation on URL's to only allow paths that translates to valid NATS subjects.
At the same time, to avoid http.ServerMux
's MovedPermanently redirects caused by other invalid URLS, such as /api/server//model
, the ServerMux
should be replaced with a custom handler.