Page MenuHomePhabricator

Cannot set Api-User-Agent header when making requests to ORES from a user script - CORS
Closed, ResolvedPublic

Description

This script demonstrates the issue. https://meta.wikimedia.org/wiki/User:EpochFail/demo_ores_user_agent_issue.js

In Chrome I see the following error when I try to load the script:

Access to XMLHttpRequest at 'https://ores.wikimedia.org/v3/scores/enwiki/1324234' from origin 'https://meta.wikimedia.org' has been blocked by CORS policy: Request header field api-user-agent is not allowed by Access-Control-Allow-Headers in preflight response.

Event Timeline

Change 960763 had a related patch set uploaded (by Ilias Sarantopoulos; author: Ilias Sarantopoulos):

[machinelearning/liftwing/inference-services@main] ores-legacy: fix CORS headers

https://gerrit.wikimedia.org/r/960763

Change 960763 merged by jenkins-bot:

[machinelearning/liftwing/inference-services@main] ores-legacy: fix CORS headers and avoid redirects

https://gerrit.wikimedia.org/r/960763

Change 960998 had a related patch set uploaded (by Ilias Sarantopoulos; author: Ilias Sarantopoulos):

[operations/deployment-charts@master] ml-services: allows CORS in ores-legacy

https://gerrit.wikimedia.org/r/960998

Change 960998 merged by jenkins-bot:

[operations/deployment-charts@master] ml-services: allows CORS in ores-legacy

https://gerrit.wikimedia.org/r/960998

Change 961044 had a related patch set uploaded (by Ilias Sarantopoulos; author: Ilias Sarantopoulos):

[machinelearning/liftwing/inference-services@main] ores-legacy: fix allowed cross origins

https://gerrit.wikimedia.org/r/961044

Change 961044 merged by jenkins-bot:

[machinelearning/liftwing/inference-services@main] ores-legacy: fix allowed cross origins

https://gerrit.wikimedia.org/r/961044

Applied a manual fix on ml-serve-codfw, it should now work. I need to add the proper config to deployment-charts to make it permanent :)

Applied a permanent fix, thanks for reporting!