Wednesday, 31 May 2017

CORS: Settings Origin of request

I'm trying to scrape ThePirateBay from the browser, via XMLHTTP requests.

I was getting the error:

XMLHttpRequest cannot load https://pirateproxy.cc/.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://127.0.0.1' is therefore not allowed access.

I added the headers:

Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept

to my server responses, before realising this error was occurring because TPB does not have the Access-Control-Allow-Origin header.

I've searched around but haven't found any feasible solutions for resolving this--only a plethora of JSONP advocations.

Is this not possible in the browser?



via Tobiq

No comments:

Post a Comment