I was given a task to setup a CNAME subdomain in CloudFlare to forward the request to Cloudinary. This way we can still have the benefit of serving static images from CDN as well as reducing the Cloudinary bandwidth usage.
My solution is to set HAProxy as a reverse proxy which responsibility to fetch images from Cloudinary server. You can see the overview diagram below:
The first thing we have to do is to create an ACL in HAProxy for our cloudinary subdomain
In the configuration below, we are telling HAProxy to forward all requests from
1 2 3 4 5 6 7
Next one is to create a new backend.
1 2 3
Restart HAProxy and you should be able to use the subdomain to serve images from Cloudinary (eg: http://cloudinary-asset.rudylee.com/rudylee/image/upload/12298848/icon/12379593943923.png )
Requesting the images through SSL should work if you have SSL termination configured in your HAProxy.