We have Kong running in multiple datacenter (DC) with one master Postgres running in one DC and other replicas in other DCs. We are using oauth2 plugin for the API routes.
We see when token is generated a write call is made to master Postgres node and the same is getting synced to other replicas. So when actual API call comes then token will be read from read replicas and then API call is allowed.
In some cases we see before the tokens are synced to the replicas the API call is made and it’s getting rejected with HTTP 401.
How can we make the token validation call also to go to master Postgres instead of replicas?
Below is the code where the token is fetched -