@@ -27,6 +27,8 @@ import (
27
27
28
28
var DISABLED_NODE_STATUS_CODES = []int {401 , 403 , 502 }
29
29
30
+ var WHITELIST_CHAINS = []string {"sui" , "solana" , "solana_das" , "solana_das_2" }
31
+
30
32
type HttpProxyMiddleware struct {
31
33
nextMiddleware middleware.Middleware
32
34
enabled bool
@@ -187,19 +189,21 @@ func (m *HttpProxyMiddleware) OnProcess(session *rpc.Session) error {
187
189
return err
188
190
}
189
191
190
- // check response header
191
- contentType := ctx .Response .Header .Peek ("Content-Type" )
192
- if ! strings .Contains (string (contentType ), "application/json" ) {
193
- log .Error ("invalid response content type" , contentType , "node" , session .NodeName )
194
- err = fmt .Errorf ("invalid response content type %s" , contentType )
195
- shouldDisableEndpoint = true
196
- now := time .Now ().UnixMilli ()
197
- _ , ok := m .disableEndpoints .Get (session .NodeName )
198
- if ! ok {
199
- m .disableEndpoints .Set (session .NodeName , now )
192
+ if ! slices .Contains (WHITELIST_CHAINS , session .Chain ) {
193
+ // check response header
194
+ contentType := ctx .Response .Header .Peek ("Content-Type" )
195
+ if ! strings .Contains (string (contentType ), "application/json" ) {
196
+ log .Error ("invalid response content type" , contentType , "node" , session .NodeName )
197
+ err = fmt .Errorf ("invalid response content type %s" , contentType )
198
+ shouldDisableEndpoint = true
199
+ now := time .Now ().UnixMilli ()
200
+ _ , ok := m .disableEndpoints .Get (session .NodeName )
201
+ if ! ok {
202
+ m .disableEndpoints .Set (session .NodeName , now )
203
+ }
204
+ ctx .SetStatusCode (500 )
205
+ return err
200
206
}
201
- ctx .SetStatusCode (500 )
202
- return err
203
207
}
204
208
205
209
// check response body
0 commit comments