I have a location block in nginx for my appservers that handles requests from clients who want to download binary objects ending in .bin that are stored on a CDN server.
location ~ ^/file/blob/dl/(.+\.bin)$ {
set $filename $1;
return http://<some_cdn_url>.com/$filename;
}
However when I make a request to my server that is for /file/blob/dl/xyz.bin it returns a 302 but doesnt actually fetch the file, how can I fix this?
I tried to do a rewrite as well instead of the return, it does something similar and returns a 301 without actually fetching the file. I can download the file directly from the cdn URL without issues.
location ~ ^/file/blob/dl/(.+\.bin)$ {
set $filename $1;
rewrite ^(.*)$ http://<some_cdn_url>.com/$filename permanent;
}
What other options can I do to solve this?