I'm developing a project which has restricted content to periodically paymetns (subscriptions) and single payment methods.
Now, I need to distribute the content globally, however, due to everybody has to pass through my main back-end to check payment verifications to give and allow an presigned URL, the point of CDN lose a bit the sense in my head.
I let an example:
If in this last step I could use CloudFront to "improve" the image redirect, it stills giving a long time to complete the cycle, because my verification process is in Europe.
Are there some way, to check if the user paid in North America? I know about replication (meaning PostgresSQL replicas and a second back-end server), but, if uploads process require a master database, at somepoint, the request will need to go to Europe to be fullfilled.
Does need my app to check where the user is located to access to the closest back-end server, which can only be functional on reading process? That means another server in North America.
Am a bit confused, so, all point of view are welcomed.
Your question title and content can be re-worked to be more focused
As you said yourself, at point number 3. A CDN does exactly its nominal use-case, saving your user from having to fetch the image from a data center far away ( putting the object or static content closer to the user )
There are different techniques to further reduce the user's delay by putting the worker/application code closer to the user and putting your database close to where your code is executed. A CDN is not one of the ways to implement these techniques