gnuns / allOrigins

:alien: Pull content from any page as JSON via API

Home Page:https://allorigins.win/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid JSONP response - Error shows DOCTYPE HTML code

Sebbo94BY opened this issue · comments

Since a few hours, I have the problem, that the below code snippet...

$.ajax({
	type: "GET",
	url: "https://api.allorigins.win/get?url=" + encodeURIComponent("https://www.teamspeak.com/versions/client.json"),
	dataType: "json",
        [...]
});

...fails with this error:

Uncaught SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at JSON.parse (<anonymous>)
    at Object.success ((index):1349:15)
    at c (jquery-3.6.0.min.js:2:28327)
    at Object.fireWith [as resolveWith] (jquery-3.6.0.min.js:2:29072)
    at l (jquery-3.6.0.min.js:2:79901)
    at XMLHttpRequest.<anonymous> (jquery-3.6.0.min.js:2:82355)

Is this maybe related to #115?

The code worked fine and as expected for the past months.

Could you please check, what's wrong here on the API side? Or did anything change?

I have the same problem in the last month, allorigins changed their Accept: header from something safe like, this is from IE 9,

    "Accept": "text/html, application/xhtml+xml, */*", 

to https://api.allorigins.win/raw?url=http://httpbin.org/get

    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",

and the application/xml triggers certain Java EE frameworks (Jackson for example) to deliver XML instead of JSON by default if its in the accept headerline.