2011-04-11 07:26:53 +00:00
|
|
|
# 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
|
2011-04-11 16:49:25 +00:00
|
|
|
proxy_ignore_headers Cache-Control;
|
|
|
|
#add_header Content-Disposition 'attachment; filename=audio.mp3';
|
|
|
|
#add_header Connection 'close';
|
2011-04-11 07:26:53 +00:00
|
|
|
|
|
|
|
# Do not touch local disks when proxying
|
|
|
|
# content to clients
|
|
|
|
proxy_max_temp_file_size 0;
|
|
|
|
|
|
|
|
# Download the file and send it to client
|
2011-04-11 08:19:47 +00:00
|
|
|
resolver 192.168.0.1;
|
2011-04-11 07:26:53 +00:00
|
|
|
proxy_pass $download_url;
|
|
|
|
}
|