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.
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:
Which translates into the invalid subject:
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
, theServerMux
should be replaced with a custom handler.