0

I need to configure cdn with nginx for images. GeoIp is working fine, but i have a problem with images that are not found on cdn server.

I configured nginx the following way: Client requests the image from server1, server1 checks if the client is from "UK" is yes redirect to CDN server. but now lets say the image is not found on CDN server server how can i redirect back to server1 if CDN server is also from "UK". this will enter to endless loop...

1 Answer 1

1

With a strategically-placed rewrite directive, you can append $uri with a parameter on the progress of redirects, and check for this parameter to decide whether or not to redirect back to CDN.

Or you could also use proxy_set_header directive when doing a request from the CDN back onto the main server1 site, and check for the existence of such HTTP header when processing requests on the main server1 site.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .