Add itunes proxy back :(

This commit is contained in:
Jonathan Cremin 2016-10-23 21:48:44 +01:00
parent 7bb0497ff4
commit b5cb3e78ab
2 changed files with 16 additions and 0 deletions

14
routes/itunes-proxy.js Normal file
View file

@ -0,0 +1,14 @@
import { parse } from 'url';
import request from 'superagent';
export default function* (next) {
const url = `http://${this.request.url.substr(8)}`;
const parsed = parse(url);
if (parsed.host.match(/mzstatic\.com/)) {
const proxyResponse = yield request.get(url);
this.set(proxyResponse.headers);
this.body = proxyResponse.body;
} else {
yield next;
}
}