Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different geo locations for blue and green deployments #8

Open
ashishagin opened this issue May 30, 2024 · 0 comments
Open

Different geo locations for blue and green deployments #8

ashishagin opened this issue May 30, 2024 · 0 comments

Comments

@ashishagin
Copy link

ashishagin commented May 30, 2024

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.

@ashishagin ashishagin changed the title Different geo locations for blue and green deployment Different geo locations for blue and green deployments May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant