# Proxy download location ~* ^/proxy-stream/(.*?)/(.*?)/(.*?)/(.*?)/(.*) { # Do not allow people to mess with this location directly # Only internal redirects are allowed internal; # Location-specific logging #access_log logs/proxy_stream.access.log debug; #error_log logs/proxy_stream.error.log debug; # Extract download url from the request set $token $1; set $remixsid $2; set $remixchk $3; set $download_host $4; set $download_uri $5; # Compose download url set $download_url http://$download_host/$download_uri; # Compose cookie string set $cookie "remixsid=$remixsid;remixchk=$remixchk"; # Set download request headers proxy_set_header Host $download_host; proxy_set_header Cookie $cookie; proxy_set_header Referer "http://vkontakte.ru/audio?album_id=0"; # The next two lines could be used if your storage # backend does not support Content-Disposition # headers used to specify file name browsers use # when save content to the disk proxy_ignore_headers Cache-Control Expires; # Do not touch local disks when proxying # content to clients proxy_max_temp_file_size 0; # Download the file and send it to client resolver 192.168.0.1; proxy_pass $download_url; }