server {
  gzip on;
  listen       25884;
  listen  [::]:25884;
  server_name  localhost;
  client_max_body_size 100M;

  location / {
    root      /usr/share/nginx/html;
    index     index.html;
    try_files $uri $uri/ /index.html;
  }

  location @rewrites {
    rewrite ^(.*)$ /index.html last;
  }

  location /api/netease/song/url/v1 {
    proxy_buffers           16 64k;
    proxy_buffer_size       128k;
    proxy_busy_buffers_size 256k;
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $remote_addr;
    proxy_set_header        X-Forwarded-Host $remote_addr;
    proxy_set_header        X-NginX-Proxy true;
    proxy_pass              http://localhost:3000/song/url/v1;
    
    sub_filter              '"url":"http://music.163.com' '"url":"/music/unblock';
    sub_filter              '"url":"https://music.163.com' '"url":"/music/unblock';
    sub_filter_types        application/json;
    sub_filter_once         off;
  }

  location /api/netease/ {
    proxy_buffers           16 64k;
    proxy_buffer_size       128k;
    proxy_busy_buffers_size 256k;
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $remote_addr;
    proxy_set_header        X-Forwarded-Host $remote_addr;
    proxy_set_header        X-NginX-Proxy true;
    proxy_pass              http://localhost:3000/;
  }

  location /music/unblock/ {
    proxy_pass              https://music.163.com/;
    proxy_buffering         off;
    proxy_request_buffering off;
  }
}
