If the user access https://explorer.hathor.network, it will work normally. However, if after that the user tries to access https://explorer.mainnet.hathor.network he/she will see a CORS problem. This happens because the first request is cached and returned on the second request. The browser identifies that the Origin in the request is different than the Access-Control-Allow-Origin in the response and shows the CORS error message to the user.
To solve that, the Origin was introduced as a cache key on node_api_get_version endpoint, which is the API that is returning CORS error.
Testing
Tests were performed using Postman and deploying a local stack of Explorer Service on AWS. Now, when the origin changes (And matches the Regex), the Access-Control-Allow-Origin returns the correct value.
Acceptance criteria
User must not see CORS error message on any domain that matches the regex.
Description
If the user access
https://explorer.hathor.network
, it will work normally. However, if after that the user tries to accesshttps://explorer.mainnet.hathor.network
he/she will see a CORS problem. This happens because the first request is cached and returned on the second request. The browser identifies that theOrigin
in the request is different than theAccess-Control-Allow-Origin
in the response and shows the CORS error message to the user.To solve that, the
Origin
was introduced as a cache key onnode_api_get_version
endpoint, which is the API that is returning CORS error.Testing
Tests were performed using Postman and deploying a local stack of Explorer Service on AWS. Now, when the origin changes (And matches the Regex), the
Access-Control-Allow-Origin
returns the correct value.Acceptance criteria
User must not see CORS error message on any domain that matches the regex.