Stakely / web3-load-balancer-configuration

Public configuration files for the multi-chain inteligent load balancer
10 stars 12 forks source link

CORS header returned is sometimes invalid #4

Closed arirubinstein closed 2 years ago

arirubinstein commented 2 years ago

When accessing the api through the load balancer, sometimes an invalid CORS header is returned. e.g.

Access to fetch at 'https://agoric-lcd.stakely.io/blocks/5922290' from origin 'https://ping.pub' has been blocked by CORS policy:
The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed. 
% curl -sS -I https://agoric-lcd.stakely.io/blocks/5922290  | grep access
access-control-allow-origin: *, *
access-control-allow-headers: *
access-control-allow-methods: *
access-control-expose-headers: Content-Length
access-control-max-age: 3600
% curl -sS -I https://agoric-lcd.stakely.io/blocks/5922290  | grep access
access-control-allow-origin: *
access-control-allow-headers: *
access-control-allow-methods: *
% curl -sS -I https://agoric-lcd.stakely.io/blocks/5922290  | grep access
access-control-allow-origin: *
access-control-allow-headers: *
access-control-allow-methods: *
% curl -sS -I https://agoric-lcd.stakely.io/blocks/5922290  | grep access
access-control-allow-origin: *
access-control-allow-headers: *
access-control-allow-methods: *
% curl -sS -I https://agoric-lcd.stakely.io/blocks/5922290  | grep access
access-control-allow-origin: *, *
access-control-allow-headers: *
access-control-allow-methods: *
access-control-expose-headers: Content-Length
access-control-max-age: 3600
% curl -sS -I https://agoric-lcd.stakely.io/blocks/5922290  | grep access
access-control-allow-origin: *, *
access-control-allow-headers: *
access-control-allow-methods: *
access-control-expose-headers: Content-Length
access-control-max-age: 3600
iicc1 commented 2 years ago

Thanks for reporting this issue. I patched it for Evmos a couple of days ago but I didn't know that it affected the rest of the nodes. I changed the way the CORS headers are rewritten in the proxy code and this error shouldn't occur anymore.