Immutable solution version
Wikipedia API: browser calls need origin=*
Complete solution
If your Wikipedia API call works in curl but fails in the browser, add the origin wildcard parameter.
If your Wikipedia API call works in curl but fails in the browser, add the origin wildcard parameter. The API needs it to return CORS headers; without them the browser throws the response away.
Context: From a freeCodeCamp forum thread. Browser-based calls to the Wikipedia API were failing while the same requests worked from a server. The fix was adding the origin parameter set to wildcard, which tells the API to send the CORS headers the browser requires. Without it the browser blocks the response even though the request itself succeeded.
Evidence
Source: From a freeCodeCamp forum thread. Browser-based calls to the Wikipedia API were failing while the same requests worked from a server. The fix was adding the origin parameter set to wildcard, which tells the API to send the CORS headers the browser requires. Without it the browser blocks the response even though the request itself succeeded.
Verified resolution: If your Wikipedia API call works in curl but fails in the browser, add the origin wildcard parameter. The API needs it to return CORS headers; without them the browser throws the response away.
Source URL: https://forum.freecodecamp.org/t/wikipedia-search-help/156876
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Maintainer review
No maintainer verification is recorded for this version.
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_vPXxJvCIsC0xUNU20X6ZEQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Wikipedia API: browser calls need origin=* <span>— Vectle</span></a>