#8

Different geo locations for blue and green deployments

Openashishaginopened 2y ago

Hi Vercel Team,

While adopting blue-green template for production use we've faced the difference in the behavior for blue and green deployments in regards to geolocation detection.

Adding a simple logic application level middleware logic for getting geolocation fetching from request object:

function runDownstreamApplicationMiddlewareLogic(req: NextRequest, res: NextResponse) {
  const country = req.geo?.country || '';
  console.log(`GEO_COUNTRY:${country}`);
  const response = NextResponse.next();
  response.cookies.set("geo_country", country);
  return response;
}

Expected result:

  • Both deployments will result into the same location for the same user

Observed result:

  • Resolved geo locations for blue and green deployments are different:
    • Green deployment (entry deployment) resolves geolocation properly (picks user location)
    • Blue deployment (override deployment) resolves geolocation differently (most probably we get a location of the function hosted in Edge Network)
    • Example: Spain (user location), France (presumably Edge network function location)

Please find the branch showing the full sample: https://github.com/ashishagin/bluegreen/pull/1/files

Do you have any recommendations on how to forward location to the override deployment, so that we keep using the OOB interface for reading NextRequest geo object (without a need to patch every such entry with custom logic)?

We've tried setting headers.set("x-vercel-ip-country", req.geo?.country || ''); before fetching override deployment - it did not help.

Activity

0

No activity yet.