-1

I have:

var url = 'http://cs7-5v4.vk-cdn.net/p10/da565dec1e4757.mp3?extra=30Z5mfWgb6cqPGfxDGrp1D7QgILPRF6pH1pUjnVlGdATqfZei1PFHNheoT19Hw41Oau34IsRFAe6f971LFoxoruML5MoGXqz';
$.get('http://www.corsproxy.com/' + url);

Result: 404 Not found

Problem: corsproxy add &from=54.161.20.93&hash=8e1a65aef18d9a to the end of the url. I assume that is the reason.

Question: Am I right about the reason? How to bypass it?

P.S. I can listen music by my url if I would pass it manually into as browser

Request details

enter image description here

Another suggestion: is that corsproxy returns the response not directly to the client but to the domain. Means my server should match that response url, and my server get 404 error.

$.ajax({
  url: 'cs7-5v4.vk-cdn.net/p10/2f9c8a5946540e.mp3?extra=BAgwPhrBv7Elf0H2dBRClDwFZhvc1adQeXmVxGmZh7HYu3SOCp1Fe8mZbkZE9yI2PvShuW0iYXhl0RPAtBWJuNPgjVA',
  success: function() { alert(success); },
  error: function(xhr) { document.body.innerHTML = xhr.responseText; }
})

inserts into bod next:

enter image description here

where app.js is my core url mapping node file.

VB_
  • 45,112
  • 42
  • 145
  • 293
  • well first thing, the url should not have `http://` in it that you are passing to that service. Second thing, that url gives a 404 on its own... – epascarello Dec 02 '14 at 17:12
  • @epascarello it can. You can go to `http://www.corsproxy.com` and read their very brief doc – VB_ Dec 02 '14 at 17:13
  • I read the doc. Did you? QUOTE: *Ex: `http://en.wikipedia.org/wiki/http` becomes `http://www.corsproxy.com/en.wikipedia.org/wiki/http`.* Do you see the http:// for wikipedia in proxy their example? – epascarello Dec 02 '14 at 17:14
  • 1
    As I stated in my first comment. The url you gave http://cs7-5v4.vk-cdn.net/p10/da565dec1e4757.mp3?extra=30Z5mfWgb6cqPGfxDGrp1D7QgILPRF6pH1pUjnVlGdATqfZei1PFHNheoT19Hw41Oau34IsRFAe6f971LFoxoruML5MoGXqz gives a 404 on its own when I request it. It is pretty hard for a proxy to not get a 404 when the source url returns a 404. If the url works for you, is it because you are logged into the service with a cookie? If so they (that website) gives a wrong http status code which should be a 401. – epascarello Dec 02 '14 at 17:16
  • @epascarello that's because that url is expired. If you tried it just after I've asked my question - you would get music there – VB_ Dec 02 '14 at 19:48
  • 1
    So the link expired in <9 minutes? – epascarello Dec 02 '14 at 19:52
  • @epascarello I download Safari to check your theory. http://cs7-5v4.vk-cdn.net/p10/2f9c8a5946540e.mp3?extra=BAgwPhrBv7Elf0H2dBRClDwFZhvc1adQeXmVxGmZh7HYu3SOCp1Fe8mZbkZE9yI2PvShuW0iYXhl0RPAtBWJuNPgjVA works for me event in Safari. What's wrong? Is that work for you? – VB_ Dec 02 '14 at 20:05

1 Answers1

0

I'm not certain about this, but I think you just need to strip out the "http://" from your url as per the documentation here: http://www.corsproxy.com/

Also the URL you gave in the example gives a 404 by itself.

Hope this helps,

Yuri

YuriK
  • 56
  • 2
  • if you'd stream it, cors proxy would add `http://` by default. Look at http://www.corsproxy.com please – VB_ Dec 02 '14 at 17:14