79230138

Date: 2024-11-27 11:52:18
Score: 0.5
Natty:
Report link

Thanks to Fedi's response I was able to more deeply understand the requirement to have a region in boto3 presign requests. I ended up assertaining the closest region by latency via a ping check against all the regions I am using based on this example.

Once the closest of my regions has been ascertained (basically the first to return a 200) that is set for the duration of the session and the region and bucket name for that selection is passed in the header of each request made to the server.

I can then use the Flask request.headers.get() method to get the headers, and inject them into the boto3 pre-signing request. The URL returned to the browser is now correctly referencing the user's closest regional S3 bucket.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Doug