FS#69890 - Enable CORS to Arch Package API

Attached to Project: Arch Linux
Opened by Clemens (celloclemens) - Friday, 05 March 2021, 19:34 GMT
Last edited by Jelle van der Waa (jelly) - Tuesday, 22 August 2023, 17:22 GMT
Task Type Feature Request
Category Web Sites
Status Closed
Assigned To Jelle van der Waa (jelly)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

It would be helpful to be able to access the package JSON API under https://www.archlinux.org/packages/search/json and potentially others. At the moment the Access-Control-Allow-Origin header is missing, so the API cannot be accessed by XHR. I think it is unintentional that this is not possible, because the whole purpose of the API is to be accessible, isn't it? It can be enabled in nginx by simply adding "Access-Control-Allow-Origin: *" as a header. Thanks!
Additional info:
* package version(s)
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:
Execute the following code in any JavaScript console in a non IE browser that is not on the same Origin as the API:
fetch(
"https://archlinux.org/packages/search/json/?name=pandoc", {
method: 'GET',
mode: 'cors',
headers: {
'Accept': 'application/json',
}
}
)
.then(response => response.json())
.then(json => console.log(json))
.catch(error =>
console.error(error)
);
This task depends upon

Closed by  Jelle van der Waa (jelly)
Tuesday, 22 August 2023, 17:22 GMT
Reason for closing:  Deferred
Additional comments about closing:  Not inclined to support this for now.
Comment by Buggy McBugFace (bugbot) - Tuesday, 08 August 2023, 19:11 GMT
This is an automated comment as this bug is open for more then 2 years. Please reply if you still experience this bug otherwise this issue will be closed after 1 month.

Loading...